From 45d1e985aae8347f8a1dea9d6471f0558c7016c8 Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Fri, 14 Jan 2011 22:33:29 +0000 Subject: [PATCH] o Unified inheritance hierarchy of POM model classes git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@1059189 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/maven/model/merge/ModelMerger.java | 72 ++++++++++--------- maven-model/src/main/mdo/maven.mdo | 67 +---------------- 2 files changed, 39 insertions(+), 100 deletions(-) diff --git a/maven-model/src/main/java/org/apache/maven/model/merge/ModelMerger.java b/maven-model/src/main/java/org/apache/maven/model/merge/ModelMerger.java index 4a591288b6..1d3b3d7bc6 100644 --- a/maven-model/src/main/java/org/apache/maven/model/merge/ModelMerger.java +++ b/maven-model/src/main/java/org/apache/maven/model/merge/ModelMerger.java @@ -1320,8 +1320,7 @@ public class ModelMerger protected void mergeReportPlugin( ReportPlugin target, ReportPlugin source, boolean sourceDominant, Map context ) { - mergeReportPlugin_Inherited( target, source, sourceDominant, context ); - mergeReportPlugin_Configuration( target, source, sourceDominant, context ); + mergeConfigurationContainer( target, source, sourceDominant, context ); mergeReportPlugin_GroupId( target, source, sourceDominant, context ); mergeReportPlugin_ArtifactId( target, source, sourceDominant, context ); mergeReportPlugin_Version( target, source, sourceDominant, context ); @@ -1370,39 +1369,6 @@ public class ModelMerger } } - protected void mergeReportPlugin_Inherited( ReportPlugin target, ReportPlugin source, boolean sourceDominant, - Map context ) - { - String src = source.getInherited(); - if ( src != null ) - { - if ( sourceDominant || target.getInherited() == null ) - { - target.setInherited( src ); - target.setLocation( "inherited", source.getLocation( "inherited" ) ); - } - } - } - - protected void mergeReportPlugin_Configuration( ReportPlugin target, ReportPlugin source, boolean sourceDominant, - Map 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 ); - } - } - protected void mergeReportPlugin_ReportSets( ReportPlugin target, ReportPlugin source, boolean sourceDominant, Map context ) { @@ -1431,6 +1397,42 @@ public class ModelMerger } } + protected void mergeReportSet( ReportSet target, ReportSet source, boolean sourceDominant, + Map context ) + { + mergeConfigurationContainer( target, source, sourceDominant, context ); + mergeReportSet_Id( target, source, sourceDominant, context ); + mergeReportSet_Reports( target, source, sourceDominant, context ); + } + + protected void mergeReportSet_Id( ReportSet target, ReportSet source, boolean sourceDominant, + Map context ) + { + String src = source.getId(); + if ( src != null ) + { + if ( sourceDominant || target.getId() == null ) + { + target.setId( src ); + target.setLocation( "id", source.getLocation( "id" ) ); + } + } + } + + protected void mergeReportSet_Reports( ReportSet target, ReportSet source, boolean sourceDominant, + Map context ) + { + List src = source.getReports(); + if ( !src.isEmpty() ) + { + List tgt = target.getReports(); + List merged = new ArrayList( tgt.size() + src.size() ); + merged.addAll( tgt ); + merged.addAll( src ); + target.setReports( merged ); + } + } + protected void mergeDependencyManagement( DependencyManagement target, DependencyManagement source, boolean sourceDominant, Map context ) { diff --git a/maven-model/src/main/mdo/maven.mdo b/maven-model/src/main/mdo/maven.mdo index 6a4c1cf149..d4e791fa6c 100644 --- a/maven-model/src/main/mdo/maven.mdo +++ b/maven-model/src/main/mdo/maven.mdo @@ -3261,6 +3261,7 @@ ReportPlugin 4.0.0 + ConfigurationContainer <plugin> element contains informations required for a report plugin. @@ -3288,25 +3289,6 @@ The version of the reporting plugin to be used. String - - inherited - 4.0.0 - String - - String - for technical reasons, the semantic type is actually Boolean. - Default value is true. - ]]> - - - - configuration - 4.0.0 - DOM - The configuration of the reporting plugin. - reportSets 4.0.0 @@ -3376,28 +3358,6 @@ { return groupId + ":" + artifactId; } - - public boolean isInherited() - { - return ( inherited != null ) ? Boolean.parseBoolean( inherited ) : true; - } - - public void setInherited( boolean inherited ) - { - this.inherited = String.valueOf( inherited ); - } - - private boolean inheritanceApplied = true; - - public void unsetInheritanceApplied() - { - this.inheritanceApplied = false; - } - - public boolean isInheritanceApplied() - { - return inheritanceApplied; - } ]]> @@ -3406,6 +3366,7 @@ ReportSet 4.0.0 + ConfigurationContainer Represents a set of reports and configuration to be used to generate them. @@ -3417,18 +3378,6 @@ default - - configuration - 4.0.0 - Configuration of the report to be used when generating this set. - DOM - - - inherited - 4.0.0 - String - Whether any configuration should be propagated to child POMs. - reports 4.0.0 @@ -3445,18 +3394,6 @@ 4.0.0