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 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 ); }
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; }
options( "id", "default".equals( exec.getId() ) ? null : exec.getId(), "inherited", exec.isInherited() ? null : "false" , "phase", exec.getPhase() ), exec.getConfiguration(), toArray( exec.getGoals() ) );
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 List<String> getGoalsToBeCalled(MavenSession session, String pluginKey, LifecyclePhase lifecyclePhase) { List<String> goals = new ArrayList<String>(); for (MavenProject mavenProject : session.getProjects()) { Plugin plugin = mavenProject.getPlugin(pluginKey); for (PluginExecution execution : plugin.getExecutions()) { for (String goal : execution.getGoals()) { if (!goals.contains(goal)) { String phase = execution.getPhase(); LifecyclePhase goalLifecylePhase = LifecyclePhase.NONE; if (phase != null) { phase = phase.trim().replace("-", "_").toUpperCase(); goalLifecylePhase = LifecyclePhase.valueOf(phase); } if (goalLifecylePhase != LifecyclePhase.NONE && goalLifecylePhase.ordinal() <= lifecyclePhase.ordinal()) { goals.add(goal); } } } } } return goals; }
@Override public List<Execution> listExecutions() { List<Execution> executions = new ArrayList<Execution>(); for (PluginExecution pluginExecution : getExecutions()) { ExecutionBuilder executionBuilder = ExecutionBuilder.create() .setId(pluginExecution.getId()).setPhase(pluginExecution.getPhase()); for (String goal : pluginExecution.getGoals()) { executionBuilder.addGoal(goal); } if (pluginExecution.getConfiguration() != null) { executionBuilder.setConfig(new ConfigurationImpl((Xpp3Dom) pluginExecution.getConfiguration())); } executions.add(executionBuilder); } return executions; }
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; }
/** * Method updatePluginExecution * * @param value * @param element * @param counter * @param xmlTag */ protected void updatePluginExecution( PluginExecution value, String xmlTag, Counter counter, Element element ) { Element root = element; Counter innerCount = new Counter( counter.getDepth() + 1 ); findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), "default" ); findAndReplaceSimpleElement( innerCount, root, "phase", value.getPhase(), null ); findAndReplaceSimpleLists( innerCount, root, value.getGoals(), "goals", "goal" ); findAndReplaceSimpleElement( innerCount, root, "inherited", value.getInherited(), null ); findAndReplaceXpp3DOM( innerCount, root, "configuration", (Xpp3Dom) value.getConfiguration() ); } // -- void updatePluginExecution(PluginExecution, String, Counter, Element)
/** * Method updatePluginExecution * * @param value * @param element * @param counter * @param xmlTag */ protected void updatePluginExecution( PluginExecution value, String xmlTag, Counter counter, Element element ) { Element root = element; Counter innerCount = new Counter( counter.getDepth() + 1 ); findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), "default" ); findAndReplaceSimpleElement( innerCount, root, "phase", value.getPhase(), null ); findAndReplaceSimpleLists( innerCount, root, value.getGoals(), "goals", "goal" ); findAndReplaceSimpleElement( innerCount, root, "inherited", value.getInherited(), null ); findAndReplaceXpp3DOM( innerCount, root, "configuration", (Xpp3Dom) value.getConfiguration() ); } // -- void updatePluginExecution(PluginExecution, String, Counter, Element)
/** * Method updatePluginExecution. * * @param value * @param element * @param counter * @param xmlTag */ protected void updatePluginExecution(PluginExecution value, String xmlTag, Counter counter, Element element) { Element root = element; Counter innerCount = new Counter(counter.getDepth() + 1); findAndReplaceSimpleElement(innerCount, root, "id", value.getId(), "default"); findAndReplaceSimpleElement(innerCount, root, "phase", value.getPhase(), null); findAndReplaceSimpleLists(innerCount, root, value.getGoals(), "goals", "goal"); findAndReplaceSimpleElement(innerCount, root, "inherited", value.getInherited(), null); findAndReplaceXpp3DOM(innerCount, root, "configuration", (Xpp3Dom)value.getConfiguration()); } //-- void updatePluginExecution(PluginExecution, String, Counter, Element)
/** * Method updatePluginExecution * * @param value * @param element * @param counter * @param xmlTag */ protected void updatePluginExecution(PluginExecution value, String xmlTag, Counter counter, Element element) { Element root = element; Counter innerCount = new Counter(counter.getDepth() + 1); findAndReplaceSimpleElement(innerCount, root, "id", value.getId(), "default"); findAndReplaceSimpleElement(innerCount, root, "phase", value.getPhase(), null); findAndReplaceSimpleLists(innerCount, root, value.getGoals(), "goals", "goal"); findAndReplaceSimpleElement(innerCount, root, "inherited", value.getInherited(), null); findAndReplaceXpp3DOM(innerCount, root, "configuration", (Xpp3Dom)value.getConfiguration()); } //-- void updatePluginExecution(PluginExecution, String, Counter, Element)
/** * Method updatePluginExecution. * * @param value * @param element * @param counter * @param xmlTag */ protected void updatePluginExecution( PluginExecution value, String xmlTag, Counter counter, Element element ) { Element root = element; Counter innerCount = new Counter( counter.getDepth() + 1 ); findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), "default" ); findAndReplaceSimpleElement( innerCount, root, "phase", value.getPhase(), null ); findAndReplaceSimpleLists( innerCount, root, value.getGoals(), "goals", "goal" ); findAndReplaceSimpleElement( innerCount, root, "inherited", value.getInherited(), null ); findAndReplaceXpp3DOM( innerCount, root, "configuration", (Xpp3Dom) value.getConfiguration() ); } // -- void updatePluginExecution(PluginExecution, String, Counter, Element)
/** * Method updatePluginExecution. * * @param value * @param element * @param counter * @param xmlTag */ protected void updatePluginExecution(PluginExecution value, String xmlTag, Counter counter, Element element) { Element root = element; Counter innerCount = new Counter(counter.getDepth() + 1); findAndReplaceSimpleElement(innerCount, root, "id", value.getId(), "default"); findAndReplaceSimpleElement(innerCount, root, "phase", value.getPhase(), null); findAndReplaceSimpleLists(innerCount, root, value.getGoals(), "goals", "goal"); findAndReplaceSimpleElement(innerCount, root, "inherited", value.getInherited(), null); findAndReplaceXpp3DOM(innerCount, root, "configuration", (Xpp3Dom) value.getConfiguration()); } // -- void updatePluginExecution(PluginExecution, String, Counter, // Element)
/** * 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()); }