Java Code Examples for org.codehaus.plexus.util.xml.Xpp3Dom#mergeXpp3Dom()

The following examples show how to use org.codehaus.plexus.util.xml.Xpp3Dom#mergeXpp3Dom() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MojoConfigurationProcessor.java    From takari-lifecycle with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Extract the Mojo specific configuration from the incoming plugin configuration from Maven by looking at an enclosing element with the goal name. Use this and merge it with the default Mojo
 * configuration and use this to apply values to the Mojo.
 * 
 * @param goal
 * @param pluginConfigurationFromMaven
 * @param defaultMojoConfiguration
 * @return
 * @throws ComponentConfigurationException
 */
PlexusConfiguration extractAndMerge(String goal, PlexusConfiguration pluginConfigurationFromMaven, PlexusConfiguration defaultMojoConfiguration) throws ComponentConfigurationException {
  //
  // We need to extract the specific configuration for this goal out of the POM configuration
  //
  PlexusConfiguration mojoConfigurationFromPom = new XmlPlexusConfiguration("configuration");
  for (PlexusConfiguration element : pluginConfigurationFromMaven.getChildren()) {
    if (element.getName().equals(goal)) {
      for (PlexusConfiguration goalConfigurationElements : element.getChildren()) {
        mojoConfigurationFromPom.addChild(goalConfigurationElements);
      }
    }
  }
  return new XmlPlexusConfiguration(Xpp3Dom.mergeXpp3Dom(convert(mojoConfigurationFromPom), convert(defaultMojoConfiguration)));
}
 
Example 2
Source File: StartDebugMojoSupport.java    From ci.maven with Apache License 2.0 5 votes vote down vote up
protected void runLibertyMojoInstallFeature(Element features) throws MojoExecutionException {
    if (!project.getProperties().containsKey("container")) {  // for now, container mode does not support installing features
        Xpp3Dom config = ExecuteMojoUtil.getPluginGoalConfig(getLibertyPlugin(), "install-feature", log);;
        if (features != null) {
            config = Xpp3Dom.mergeXpp3Dom(configuration(features), config);
        }
        runLibertyMojo("install-feature", config);   
    }
}
 
Example 3
Source File: DevMojo.java    From ci.maven with Apache License 2.0 5 votes vote down vote up
/**
 * Executes Maven goal passed but sets failOnError to false
 * All errors are logged as warning messages
 * 
 * @param goal Maven compile goal
 * @throws MojoExecutionException
 */
private void runCompileMojo(String goal) throws MojoExecutionException {
    Plugin plugin = getPlugin("org.apache.maven.plugins", "maven-compiler-plugin");
    Xpp3Dom config = ExecuteMojoUtil.getPluginGoalConfig(plugin, goal, log);
    config = Xpp3Dom.mergeXpp3Dom(configuration(element(name("failOnError"), "false")), config);
    log.info("Running maven-compiler-plugin:" + goal);
    log.debug("configuration:\n" + config);
    executeMojo(plugin, goal(goal), config,
            executionEnvironment(project, session, pluginManager));
}
 
Example 4
Source File: MojoConfigurationProcessor.java    From takari-lifecycle with Eclipse Public License 1.0 4 votes vote down vote up
PlexusConfiguration mergePlexusConfiguration(PlexusConfiguration dominant, PlexusConfiguration recessive) throws ComponentConfigurationException {
  return new XmlPlexusConfiguration(Xpp3Dom.mergeXpp3Dom(convert(dominant), convert(recessive)));
}