private static void mergePluginExecutionDefinitions( PluginExecution child, PluginExecution parent ) { if ( child.getPhase() == null ) { child.setPhase( parent.getPhase() ); } List parentGoals = parent.getGoals(); List childGoals = child.getGoals(); List goals = new ArrayList(); if ( ( childGoals != null ) && !childGoals.isEmpty() ) { goals.addAll( childGoals ); } if ( parentGoals != null ) { for ( Iterator goalIterator = parentGoals.iterator(); goalIterator.hasNext(); ) { String goal = (String) goalIterator.next(); if ( !goals.contains( goal ) ) { goals.add( goal ); } } } child.setGoals( goals ); Xpp3Dom childConfiguration = (Xpp3Dom) child.getConfiguration(); Xpp3Dom parentConfiguration = (Xpp3Dom) parent.getConfiguration(); childConfiguration = Xpp3Dom.mergeXpp3Dom( childConfiguration, parentConfiguration ); child.setConfiguration( childConfiguration ); }
private static void mergePluginExecutionDefinitions( PluginExecution child, PluginExecution parent ) { if ( child.getPhase() == null ) { child.setPhase( parent.getPhase() ); } List<String> parentGoals = parent.getGoals(); List<String> childGoals = child.getGoals(); List<String> goals = new ArrayList<>(); if ( ( childGoals != null ) && !childGoals.isEmpty() ) { goals.addAll( childGoals ); } if ( parentGoals != null ) { for ( String goal : parentGoals ) { if ( !goals.contains( goal ) ) { goals.add( goal ); } } } child.setGoals( goals ); Xpp3Dom childConfiguration = (Xpp3Dom) child.getConfiguration(); Xpp3Dom parentConfiguration = (Xpp3Dom) parent.getConfiguration(); childConfiguration = Xpp3Dom.mergeXpp3Dom( childConfiguration, parentConfiguration ); child.setConfiguration( childConfiguration ); }
private void expand( List<Plugin> plugins ) { for ( Plugin plugin : plugins ) { Xpp3Dom pluginConfiguration = (Xpp3Dom) plugin.getConfiguration(); if ( pluginConfiguration != null ) { for ( PluginExecution execution : plugin.getExecutions() ) { Xpp3Dom executionConfiguration = (Xpp3Dom) execution.getConfiguration(); executionConfiguration = Xpp3Dom.mergeXpp3Dom( executionConfiguration, new Xpp3Dom( pluginConfiguration ) ); execution.setConfiguration( executionConfiguration ); } } } }
if ( lifecycleConfiguration != null ) execution.setConfiguration( new Xpp3Dom( lifecycleConfiguration ) );
public static PluginExecution clonePluginExecution( PluginExecution src ) { PluginExecution result = null; if ( src != null ) { result = new PluginExecution(); result.setId( src.getId() ); result.setGoals( cloneListOfStrings( src.getGoals() ) ); result.setConfiguration( cloneConfiguration( src.getConfiguration() ) ); result.setInherited( src.getInherited() ); result.setPhase( src.getPhase() ); } return result; }
pluginExecution.setConfiguration( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser, true ) );
pluginExecution.setConfiguration( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser, true ) );
public default WrapperPluginExecutionBuilder execution(PluginExecutionNamedValue... namedValues) { PluginExecution execution = new PluginExecution(); Map<String, String> map = new HashMap<>(); for (PluginExecutionNamedValue kvp : namedValues) { if (kvp instanceof ConfigurationNamedValue) { execution.setConfiguration(((ConfigurationNamedValue) kvp).getConfiguration()); } else if (kvp instanceof PluginExecutionGoalsNamedValue) { execution.setGoals(((PluginExecutionGoalsNamedValue)kvp).getGoals()); } else { map.put(kvp.name(), kvp.value()); NamedValueProcessor.mapToObject(execution, map); } } return new WrapperPluginExecutionBuilder(execution); }
public PluginExecution get() { PluginExecution execution = new PluginExecution(); if (configuration != null) { execution.setConfiguration(configuration); } if (goals != null) { execution.setGoals(goals); } execution.setId(id); execution.setInherited(inherited); execution.setPhase(phase); execution.setPriority(priority); return execution; }
pluginExecution.setConfiguration( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser ) );
execution.setConfiguration(config);
private void addEnforcerPluginExecution(MavenProject mavenProject, Xpp3Dom configuration) { List<String> goals = new ArrayList<String>(); goals.add("enforce"); PluginExecution pe = new PluginExecution(); pe.setId("enforce-" + mavenProject.getPackaging()); pe.setGoals(goals); pe.setConfiguration(configuration); if (pe != null) { this.plugin.getExecutions().add(pe); } }
protected void setPluginScalarConfigurationValueInAllExecutions(final String key, final String value, final boolean override, final Plugin plugin) { for (PluginExecution execution : plugin.getExecutions()) { Xpp3Dom executionConfiguration = setPluginScalarConfigurationValue(key, value, override, (Xpp3Dom) execution.getConfiguration()); execution.setConfiguration(executionConfiguration); } }
protected <T> T getParameterValue(String parameter, Class<T> asType, MavenSession session, MojoExecution mojoExecution) throws CoreException { PluginExecution execution = new PluginExecution(); execution.setConfiguration(mojoExecution.getConfiguration()); return maven.getMojoParameterValue(parameter, asType, session, mojoExecution.getPlugin(), execution, mojoExecution.getGoal()); }
private void expand( List<Plugin> plugins ) { for ( Plugin plugin : plugins ) { Xpp3Dom pluginConfiguration = (Xpp3Dom) plugin.getConfiguration(); if ( pluginConfiguration != null ) { for ( PluginExecution execution : plugin.getExecutions() ) { Xpp3Dom executionConfiguration = (Xpp3Dom) execution.getConfiguration(); executionConfiguration = Xpp3Dom.mergeXpp3Dom( executionConfiguration, new Xpp3Dom( pluginConfiguration ) ); execution.setConfiguration( executionConfiguration ); } } } }
public void merge( Model target, Model source, boolean sourceDominant, Map<?, ?> hints ) { Map<Object, Object> context = new HashMap<Object, Object>(); if ( hints != null ) { context.putAll( hints ); } super.merge(target, source, sourceDominant, hints); if (source.getBuild() != null) { super.merge(target, source, sourceDominant,context); for(Plugin sourcePlugin : source.getBuild().getPlugins()) { Plugin targetPlugin = target.getBuild().getPluginsAsMap().get(sourcePlugin.getKey()); super.mergePlugin(targetPlugin, sourcePlugin, sourceDominant, context); Set<Entry<String, PluginExecution>> entrySet = targetPlugin.getExecutionsAsMap().entrySet(); for (Entry<String, PluginExecution> entry : entrySet) { PluginExecution execution = entry.getValue(); if (execution.getConfiguration() == null) { execution.setConfiguration(sourcePlugin.getConfiguration()); } } } } } }
private List<PluginExecution> transformExecutions(final MavenPlugin mavenPlugin) { List<PluginExecution> executions = new ArrayList<PluginExecution>(); for (Execution execution : mavenPlugin.listExecutions()) { PluginExecution pluginExecution = new PluginExecution(); pluginExecution.setId(execution.getId()); pluginExecution.setPhase(execution.getPhase()); pluginExecution.setGoals(execution.getGoals()); pluginExecution.setConfiguration(parseConfig(execution.getConfig())); executions.add(pluginExecution); } return executions; }
private void install() throws XmlPullParserException, IOException { MavenCoreFacet mvn = project.getFacet(MavenCoreFacet.class); Model pom = mvn.getPOM(); org.apache.maven.model.Plugin plugin = new org.apache.maven.model.Plugin(); plugin.setArtifactId(dep.getArtifactId()); plugin.setGroupId(dep.getGroupId()); plugin.setVersion(dep.getVersion()); Xpp3Dom dom = Xpp3DomBuilder.build(new ByteArrayInputStream("<configuration></configuration>".getBytes()), "UTF-8"); List<PluginExecution> executions = plugin.getExecutions(); PluginExecution execution = new PluginExecution(); execution.setPhase("package"); execution.addGoal("shade"); execution.setConfiguration(dom); executions.add(execution); pom.getBuild().getPlugins().add(plugin); mvn.setPOM(pom); }
private void modifyConfiguration(final ModifyNode command) { try { assertInstalled(); MavenCoreFacet mvn = project.getFacet(MavenCoreFacet.class); Model pom = mvn.getPOM(); org.apache.maven.model.Plugin plugin = getPlugin(pom); PluginExecution execution = plugin.getExecutions().get(0); Node configuration = XMLParser.parse(((Xpp3Dom) execution.getConfiguration()).toUnescapedString()); command.modify(configuration); execution.setConfiguration(Xpp3DomBuilder.build(XMLParser.toXMLInputStream(configuration), "UTF-8")); mvn.setPOM(pom); } catch (Exception e) { throw new RuntimeException("Error updating configuration", e); } }
exec.setGoals(Collections.singletonList("directory-single")); //NOI18N if (exec.getConfiguration() == null) { exec.setConfiguration(new Xpp3Dom(CONFIGURATION_EL));