code: public static Xpp3Dom getBuildPluginConfiguration(AbstractWisdomMojo mojo, String artifactId, String goal) {
          List<Plugin> plugins = mojo.project.getBuildPlugins();
  
          Plugin plugin = null;
          for (Plugin plug : plugins) {
              if (plug.getArtifactId().equals(artifactId)) {
                  plugin = plug;
              }
          }
  
          if (plugin == null) {
              // Not found
              return null;
          }
  
          if (goal != null) {
              // Check main execution
              List<String> globalGoals = (List<String>) plugin.getGoals();
              if (globalGoals != null && globalGoals.contains(goal)) {
                  return (Xpp3Dom) plugin.getConfiguration();
              }
              // Check executions
              for (PluginExecution execution : plugin.getExecutions()) {
                  if (execution.getGoals().contains(goal)) {
                      return (Xpp3Dom) execution.getConfiguration();
                  }
              }
          }
          // Global configuration.
          return (Xpp3Dom) plugin.getConfiguration();
      }
docs: Retrieves the main configuration of the given plugin from the Maven Project.
  
  @param mojo       the mojo
  @param artifactId the artifact id of the plugin
  @param goal       an optional goal. If set if first check for a specific configuration executing this
  goal, if not found, it returns the global configuration
  @return the configuration, {@code null} if not found