/** * Merge two DOMs. Copy the dominant DOM so the original one is left unchanged. * <p> * Use this method instead of a direct call to {@link Xpp3Dom#mergeXpp3Dom(Xpp3Dom, Xpp3Dom)}. * Profiles are dominant, thus they are merge targets, but they may be merged in several times * (e.g. if they are inherited). So with the second merge, you don't get the profile's original * DOM, but an already merged one. * * @param dominant Dominant DOM * @param recessive Recessive DOM * @return Merged DOM */ private Xpp3Dom merge( Xpp3Dom dominant, Xpp3Dom recessive ) { Xpp3Dom dominantCopy = ( dominant == null ) ? null : new Xpp3Dom( dominant ); return Xpp3Dom.mergeXpp3Dom( dominantCopy, recessive ); }
protected void mergeToolchainModelConfiguration( ToolchainModel target, ToolchainModel source ) { Xpp3Dom src = (Xpp3Dom) source.getConfiguration(); if ( src != null ) { Xpp3Dom tgt = (Xpp3Dom) target.getConfiguration(); if ( tgt == null ) { tgt = Xpp3Dom.mergeXpp3Dom( new Xpp3Dom( src ), tgt ); } else { tgt = Xpp3Dom.mergeXpp3Dom( tgt, src ); } target.setConfiguration( tgt ); } }
protected void mergeConfigurationContainer_Configuration( ConfigurationContainer target, ConfigurationContainer source, boolean sourceDominant, Map<Object, Object> context ) { Xpp3Dom src = (Xpp3Dom) source.getConfiguration(); if ( src != null ) { Xpp3Dom tgt = (Xpp3Dom) target.getConfiguration(); if ( sourceDominant || tgt == null ) { tgt = Xpp3Dom.mergeXpp3Dom( new Xpp3Dom( src ), tgt ); } else { tgt = Xpp3Dom.mergeXpp3Dom( tgt, src ); } target.setConfiguration( tgt ); } }
private static void mergeReportSetDefinitions( ReportSet child, ReportSet parent ) { List parentReports = parent.getReports(); List childReports = child.getReports(); List reports = new ArrayList(); if ( ( childReports != null ) && !childReports.isEmpty() ) { reports.addAll( childReports ); } if ( parentReports != null ) { for ( Iterator i = parentReports.iterator(); i.hasNext(); ) { String report = (String) i.next(); if ( !reports.contains( report ) ) { reports.add( report ); } } } child.setReports( reports ); Xpp3Dom childConfiguration = (Xpp3Dom) child.getConfiguration(); Xpp3Dom parentConfiguration = (Xpp3Dom) parent.getConfiguration(); childConfiguration = Xpp3Dom.mergeXpp3Dom( childConfiguration, parentConfiguration ); child.setConfiguration( childConfiguration ); }
private static void mergeReportSetDefinitions( ReportSet child, ReportSet parent ) { List<String> parentReports = parent.getReports(); List<String> childReports = child.getReports(); List<String> reports = new ArrayList<>(); if ( ( childReports != null ) && !childReports.isEmpty() ) { reports.addAll( childReports ); } if ( parentReports != null ) { for ( String report : parentReports ) { if ( !reports.contains( report ) ) { reports.add( report ); } } } child.setReports( reports ); 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 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 ); }
Xpp3Dom parentConfiguration = (Xpp3Dom) parent.getConfiguration(); childConfiguration = Xpp3Dom.mergeXpp3Dom( childConfiguration, parentConfiguration );
dom = Xpp3Dom.mergeXpp3Dom( newDom, dom );
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 ); }
dom = Xpp3Dom.mergeXpp3Dom( newDom, dom );
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 ); } } } }
dom = Xpp3Dom.mergeXpp3Dom( newDom, dom );
Xpp3Dom parentConfiguration = (Xpp3Dom) parent.getConfiguration(); childConfiguration = Xpp3Dom.mergeXpp3Dom( childConfiguration, parentConfiguration );
@Override public void expandPluginConfiguration( Model model, ModelBuildingRequest request, ModelProblemCollector problems ) { Reporting reporting = model.getReporting(); if ( reporting != null ) { for ( ReportPlugin reportPlugin : reporting.getPlugins() ) { Xpp3Dom parentDom = (Xpp3Dom) reportPlugin.getConfiguration(); if ( parentDom != null ) { for ( ReportSet execution : reportPlugin.getReportSets() ) { Xpp3Dom childDom = (Xpp3Dom) execution.getConfiguration(); childDom = Xpp3Dom.mergeXpp3Dom( childDom, new Xpp3Dom( parentDom ) ); execution.setConfiguration( childDom ); } } } } }
Xpp3Dom parentConfiguration = (Xpp3Dom) parent.getConfiguration(); childConfiguration = Xpp3Dom.mergeXpp3Dom( childConfiguration, parentConfiguration );
forkedConfiguration = Xpp3Dom.mergeXpp3Dom( phaseConfiguration, forkedConfiguration );
parameterConfiguration = Xpp3Dom.mergeXpp3Dom( parameterConfiguration, parameterDefaults, Boolean.TRUE );
@Override public void configure( MavenProject project, MojoExecution mojoExecution, boolean allowPluginLevelConfig ) { String g = mojoExecution.getGroupId(); String a = mojoExecution.getArtifactId(); Plugin plugin = findPlugin( g, a, project.getBuildPlugins() ); if ( plugin == null && project.getPluginManagement() != null ) { plugin = findPlugin( g, a, project.getPluginManagement().getPlugins() ); } if ( plugin != null ) { PluginExecution pluginExecution = findPluginExecution( mojoExecution.getExecutionId(), plugin.getExecutions() ); Xpp3Dom pomConfiguration = null; if ( pluginExecution != null ) { pomConfiguration = (Xpp3Dom) pluginExecution.getConfiguration(); } else if ( allowPluginLevelConfig ) { pomConfiguration = (Xpp3Dom) plugin.getConfiguration(); } Xpp3Dom mojoConfiguration = ( pomConfiguration != null ) ? new Xpp3Dom( pomConfiguration ) : null; mojoConfiguration = Xpp3Dom.mergeXpp3Dom( mojoExecution.getConfiguration(), mojoConfiguration ); mojoExecution.setConfiguration( mojoConfiguration ); } }
parameterConfiguration = Xpp3Dom.mergeXpp3Dom( parameterConfiguration, parameterDefaults, Boolean.TRUE );
configuration = Xpp3Dom.mergeXpp3Dom( configuration, execution.getConfiguration() );