org.codehaus.plexus.util.xml.Xpp3DomUtils Java Examples
The following examples show how to use
org.codehaus.plexus.util.xml.Xpp3DomUtils.
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: MultiStartMojo.java From wildfly-swarm with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") protected void startProject(MavenProject project, String executionId, XmlPlexusConfiguration process) throws InvalidPluginDescriptorException, PluginResolutionException, PluginDescriptorParsingException, PluginNotFoundException, PluginConfigurationException, MojoFailureException, MojoExecutionException, PluginManagerException { Plugin plugin = this.project.getPlugin("org.wildfly.swarm:wildfly-swarm-plugin"); Xpp3Dom config = getConfiguration(project, executionId); Xpp3Dom processConfig = getProcessConfiguration(process); Xpp3Dom globalConfig = getGlobalConfig(); Xpp3Dom mergedConfig = Xpp3DomUtils.mergeXpp3Dom(processConfig, config); mergedConfig = Xpp3DomUtils.mergeXpp3Dom(mergedConfig, globalConfig); PluginDescriptor pluginDescriptor = this.pluginManager.loadPlugin(plugin, project.getRemotePluginRepositories(), this.repositorySystemSession); MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo("start"); MojoExecution mojoExecution = new MojoExecution(mojoDescriptor, mergedConfig); mavenSession.setCurrentProject(project); this.pluginManager.executeMojo(mavenSession, mojoExecution); List<SwarmProcess> launched = (List<SwarmProcess>) mavenSession.getPluginContext(pluginDescriptor, project).get("swarm-process"); List<SwarmProcess> procs = (List<SwarmProcess>) getPluginContext().get("swarm-process"); if (procs == null) { procs = new ArrayList<>(); getPluginContext().put("swarm-process", procs); } procs.addAll(launched); mavenSession.setCurrentProject(this.project); }
Example #2
Source File: MultiStartMojo.java From thorntail with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") protected void startProject(MavenProject project, String executionId, XmlPlexusConfiguration process) throws InvalidPluginDescriptorException, PluginResolutionException, PluginDescriptorParsingException, PluginNotFoundException, PluginConfigurationException, MojoFailureException, MojoExecutionException, PluginManagerException { Plugin plugin = this.project.getPlugin(THORNTAIL_MAVEN_PLUGIN); Xpp3Dom config = getConfiguration(project, executionId); Xpp3Dom processConfig = getProcessConfiguration(process); Xpp3Dom globalConfig = getGlobalConfig(); Xpp3Dom mergedConfig = Xpp3DomUtils.mergeXpp3Dom(processConfig, config); mergedConfig = Xpp3DomUtils.mergeXpp3Dom(mergedConfig, globalConfig); PluginDescriptor pluginDescriptor = this.pluginManager.loadPlugin(plugin, project.getRemotePluginRepositories(), this.repositorySystemSession); MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo("start"); MojoExecution mojoExecution = new MojoExecution(mojoDescriptor, mergedConfig); mavenSession.setCurrentProject(project); this.pluginManager.executeMojo(mavenSession, mojoExecution); List<SwarmProcess> launched = (List<SwarmProcess>) mavenSession.getPluginContext(pluginDescriptor, project).get(THORNTAIL_PROCESS); List<SwarmProcess> procs = (List<SwarmProcess>) getPluginContext().get(THORNTAIL_PROCESS); if (procs == null) { procs = new ArrayList<>(); getPluginContext().put(THORNTAIL_PROCESS, procs); } procs.addAll(launched); mavenSession.setCurrentProject(this.project); }
Example #3
Source File: MultiStartMojo.java From ARCHIVE-wildfly-swarm with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") protected void startProject(MavenProject project, String executionId, XmlPlexusConfiguration process) throws InvalidPluginDescriptorException, PluginResolutionException, PluginDescriptorParsingException, PluginNotFoundException, PluginConfigurationException, MojoFailureException, MojoExecutionException, PluginManagerException { Plugin plugin = this.project.getPlugin("org.wildfly.swarm:wildfly-swarm-plugin"); Xpp3Dom config = getConfiguration(project, executionId); Xpp3Dom processConfig = getProcessConfiguration(process); Xpp3Dom globalConfig = getGlobalConfig(); Xpp3Dom mergedConfig = Xpp3DomUtils.mergeXpp3Dom(processConfig, config); mergedConfig = Xpp3DomUtils.mergeXpp3Dom(mergedConfig, globalConfig); PluginDescriptor pluginDescriptor = this.pluginManager.loadPlugin(plugin, project.getRemotePluginRepositories(), this.repositorySystemSession); MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo("start"); MojoExecution mojoExecution = new MojoExecution(mojoDescriptor, mergedConfig); mavenSession.setCurrentProject(project); this.pluginManager.executeMojo(mavenSession, mojoExecution); List<SwarmProcess> launched = (List<SwarmProcess>) mavenSession.getPluginContext(pluginDescriptor, project).get("swarm-process"); List<SwarmProcess> procs = (List<SwarmProcess>) getPluginContext().get("swarm-process"); if (procs == null) { procs = new ArrayList<>(); getPluginContext().put("swarm-process", procs); } procs.addAll(launched); mavenSession.setCurrentProject(this.project); }
Example #4
Source File: IteratorMojo.java From iterator-maven-plugin with Apache License 2.0 | 5 votes |
private Xpp3Dom handlePluginConfigurationFromPluginManagement( PluginExecutor pluginExecutor, Plugin executePlugin ) { Xpp3Dom resultConfiguration = toXpp3Dom( pluginExecutor.getConfiguration() ); getLog().debug( "Configuration: " + resultConfiguration.toString() ); if ( executePlugin.getConfiguration() != null ) { Xpp3Dom x = (Xpp3Dom) executePlugin.getConfiguration(); resultConfiguration = Xpp3DomUtils.mergeXpp3Dom( toXpp3Dom( pluginExecutor.getConfiguration() ), x ); getLog().debug( "ConfigurationExecutePlugin: " + executePlugin.getConfiguration().toString() ); } return resultConfiguration; }
Example #5
Source File: AbstractSarlMojo.java From sarl with Apache License 2.0 | 4 votes |
/** Execute another MOJO. * * @param groupId identifier of the MOJO plugin group. * @param artifactId identifier of the MOJO plugin artifact. * @param version version of the MOJO plugin version. * @param goal the goal to run. * @param configuration the XML code for the configuration. * @param dependencies the dependencies of the plugin. * @throws MojoExecutionException when cannot run the MOJO. * @throws MojoFailureException when the build failed. */ protected void executeMojo( String groupId, String artifactId, String version, String goal, String configuration, Dependency... dependencies) throws MojoExecutionException, MojoFailureException { final Plugin plugin = new Plugin(); plugin.setArtifactId(artifactId); plugin.setGroupId(groupId); plugin.setVersion(version); plugin.setDependencies(Arrays.asList(dependencies)); getLog().debug(MessageFormat.format(Messages.AbstractSarlMojo_0, plugin.getId())); final PluginDescriptor pluginDescriptor = this.mavenHelper.loadPlugin(plugin); if (pluginDescriptor == null) { throw new MojoExecutionException(MessageFormat.format(Messages.AbstractSarlMojo_1, plugin.getId())); } final MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo(goal); if (mojoDescriptor == null) { throw new MojoExecutionException(MessageFormat.format(Messages.AbstractSarlMojo_2, goal)); } final Xpp3Dom mojoXml; try { mojoXml = this.mavenHelper.toXpp3Dom(mojoDescriptor.getMojoConfiguration()); } catch (PlexusConfigurationException e1) { throw new MojoExecutionException(e1.getLocalizedMessage(), e1); } Xpp3Dom configurationXml = this.mavenHelper.toXpp3Dom(configuration, getLog()); if (configurationXml != null) { configurationXml = Xpp3DomUtils.mergeXpp3Dom( configurationXml, mojoXml); } else { configurationXml = mojoXml; } getLog().debug(MessageFormat.format(Messages.AbstractSarlMojo_3, plugin.getId(), configurationXml.toString())); final MojoExecution execution = new MojoExecution(mojoDescriptor, configurationXml); this.mavenHelper.executeMojo(execution); }
Example #6
Source File: IteratorMojo.java From iterator-maven-plugin with Apache License 2.0 | 4 votes |
private MojoExecution mojoExecution( MojoDescriptor mojoDescriptor, Xpp3Dom configuration ) { Xpp3Dom resultConfiguration = Xpp3DomUtils.mergeXpp3Dom( configuration, toXpp3Dom( mojoDescriptor.getMojoConfiguration() ) ); return new MojoExecution( mojoDescriptor, resultConfiguration ); }