in maven-project/src/main/java/org/apache/maven/project/ModelUtils.java [771:847]
public static void mergeReportPluginDefinitions( ReportPlugin child, ReportPlugin parent,
boolean handleAsInheritance )
{
if ( ( child == null ) || ( parent == null ) )
{
// nothing to do.
return;
}
if ( ( child.getVersion() == null ) && ( parent.getVersion() != null ) )
{
child.setVersion( parent.getVersion() );
}
String parentInherited = parent.getInherited();
boolean parentIsInherited = ( parentInherited == null ) || Boolean.valueOf( parentInherited ).booleanValue();
// merge configuration just like with build plugins
if ( parentIsInherited )
{
Xpp3Dom childConfiguration = (Xpp3Dom) child.getConfiguration();
Xpp3Dom parentConfiguration = (Xpp3Dom) parent.getConfiguration();
childConfiguration = Xpp3Dom.mergeXpp3Dom( childConfiguration, parentConfiguration );
child.setConfiguration( childConfiguration );
}
// from here to the end of the method is dealing with merging of the <executions/> section.
List<ReportSet> parentReportSets = parent.getReportSets();
if ( ( parentReportSets != null ) && !parentReportSets.isEmpty() )
{
Map<String, ReportSet> assembledReportSets = new LinkedHashMap<String, ReportSet>();
Map<String, ReportSet> childReportSets = child.getReportSetsAsMap();
for ( ReportSet parentReportSet : parentReportSets )
{
if ( !handleAsInheritance || parentIsInherited )
{
ReportSet assembledReportSet = parentReportSet;
ReportSet childReportSet = childReportSets.get( parentReportSet.getId() );
if ( childReportSet != null )
{
mergeReportSetDefinitions( childReportSet, parentReportSet );
assembledReportSet = childReportSet;
}
else if ( handleAsInheritance && ( parentInherited == null ) )
{
parentReportSet.unsetInheritanceApplied();
}
assembledReportSets.put( assembledReportSet.getId(), assembledReportSet );
}
}
for ( Map.Entry<String, ReportSet> entry : childReportSets.entrySet() )
{
String id = entry.getKey();
if ( !assembledReportSets.containsKey( id ) )
{
assembledReportSets.put( id, entry.getValue() );
}
}
child.setReportSets( new ArrayList<ReportSet>( assembledReportSets.values() ) );
child.flushReportSetMap();
}
}