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 ); }
protected void mergePluginExecution_Phase( PluginExecution target, PluginExecution source, boolean sourceDominant, Map<Object, Object> context ) { String src = source.getPhase(); if ( src != null ) { if ( sourceDominant || target.getPhase() == null ) { target.setPhase( src ); target.setLocation( "phase", source.getLocation( "phase" ) ); } } }
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 ); }
modelExecution.setPhase( profileExecution.getPhase() );
execution.setPhase( phase ); execution.setPriority( i - mojos.size() ); execution.getGoals().add( gs.goal );
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.setPhase( interpolatedTrimmed( parser.nextText(), "phase" ) );
pluginExecution.setPhase( interpolatedTrimmed( parser.nextText(), "phase" ) );
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.setPhase( getTrimmedValue( value ) );
execution.setId(id); execution.setPhase(task.getPhase()); execution.setGoals(goals);
protected void mergePluginExecution_Phase( PluginExecution target, PluginExecution source, boolean sourceDominant, Map<Object, Object> context ) { String src = source.getPhase(); if ( src != null ) { if ( sourceDominant || target.getPhase() == null ) { target.setPhase( src ); target.setLocation( "phase", source.getLocation( "phase" ) ); } } }
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; }
public static void disableMavenCompilerAlreadyPresent(Plugin plugin) { Xpp3Dom skipMain = new Xpp3Dom(MavenConfig.MAVEN_SKIP_MAIN); skipMain.setValue(TRUE); Xpp3Dom skip = new Xpp3Dom(MavenConfig.MAVEN_SKIP); skip.setValue(TRUE); Xpp3Dom configuration = new Xpp3Dom(MavenConfig.MAVEN_PLUGIN_CONFIGURATION); configuration.addChild(skipMain); configuration.addChild(skip); plugin.setConfiguration(configuration); PluginExecution exec = new PluginExecution(); exec.setId(MavenConfig.MAVEN_DEFAULT_COMPILE); exec.setPhase(MavenConfig.MAVEN_PHASE_NONE); List<PluginExecution> executions = new ArrayList<>(); executions.add(exec); plugin.setExecutions(executions); } }
public static Plugin getNewCompilerPlugin(Map<ConfigurationKey, String> conf) { Plugin newCompilerPlugin = new Plugin(); newCompilerPlugin.setGroupId(conf.get(ConfigurationKey.TAKARI_COMPILER_PLUGIN_GROUP)); newCompilerPlugin.setArtifactId(conf.get(ConfigurationKey.TAKARI_COMPILER_PLUGIN_ARTIFACT)); newCompilerPlugin.setVersion(conf.get(ConfigurationKey.TAKARI_COMPILER_PLUGIN_VERSION)); Xpp3Dom compilerId = new Xpp3Dom(MavenConfig.MAVEN_COMPILER_ID); compilerId.setValue(conf.get(ConfigurationKey.COMPILER)); Xpp3Dom sourceVersion = new Xpp3Dom(MavenConfig.MAVEN_SOURCE); sourceVersion.setValue(conf.get(ConfigurationKey.SOURCE_VERSION)); Xpp3Dom targetVersion = new Xpp3Dom(MavenConfig.MAVEN_TARGET); targetVersion.setValue(conf.get(ConfigurationKey.TARGET_VERSION)); Xpp3Dom failOnError = new Xpp3Dom(MavenConfig.FAIL_ON_ERROR); failOnError.setValue(conf.get(ConfigurationKey.FAIL_ON_ERROR)); Xpp3Dom configuration = new Xpp3Dom(MavenConfig.MAVEN_PLUGIN_CONFIGURATION); configuration.addChild(compilerId); configuration.addChild(sourceVersion); configuration.addChild(targetVersion); configuration.addChild(failOnError); newCompilerPlugin.setConfiguration(configuration); PluginExecution execution = new PluginExecution(); execution.setId(MavenCLIArgs.DEFAULT_COMPILE); execution.setGoals(Arrays.asList(MavenCLIArgs.COMPILE)); execution.setPhase(MavenCLIArgs.COMPILE); newCompilerPlugin.setExecutions(Arrays.asList(execution)); return newCompilerPlugin; }
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 PluginExecution clone(PluginExecution execution) { PluginExecution clonedExecution = new PluginExecution(); clonedExecution.setId(execution.getId() + "-snapshot"); clonedExecution.setGoals(execution.getGoals()); clonedExecution.setPhase(execution.getPhase()); clonedExecution.setPriority(execution.getPriority()); return clonedExecution; }
projectExecution.setPhase(ELUtils.getStringValue( elContext, execution.getPhase()));
/** * Interpolates elements of the {@link PluginExecution} object. * * @param execution * {@link PluginExecution} object whose elements to interpolate. */ private void interpolateExecution(final PluginExecution execution) { execution.setId( interpolateString(execution.getId())); execution.setInherited( interpolateString(execution.getInherited())); execution.setPhase( interpolateString(execution.getPhase())); interpolateDOM((Xpp3Dom) execution.getConfiguration()); interpolateStrings(execution.getGoals()); }
assPlugin.addExecution(exec); exec.setPhase("package"); //NOI18N exec.setGoals(Collections.singletonList("directory-single")); //NOI18N if (exec.getConfiguration() == null) {