diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java b/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java index e9421a4d7f..da0673af74 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java @@ -126,6 +126,7 @@ public class DefaultInheritanceAssembler { // NOTE: Enforce recursive merge to trigger merging/inheritance logic for executions Plugin plugin = new Plugin(); + plugin.setLocation( "", element.getLocation( "" ) ); plugin.setGroupId( null ); mergePlugin( plugin, element, sourceDominant, context ); @@ -208,6 +209,7 @@ public class DefaultInheritanceAssembler { // NOTE: Enforce recursive merge to trigger merging/inheritance logic for executions as well ReportPlugin plugin = new ReportPlugin(); + plugin.setLocation( "", element.getLocation( "" ) ); plugin.setGroupId( null ); mergeReportPlugin( plugin, element, sourceDominant, context ); diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/merge/MavenModelMerger.java b/maven-model-builder/src/main/java/org/apache/maven/model/merge/MavenModelMerger.java index e52d233bd8..79a358fd38 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/merge/MavenModelMerger.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/merge/MavenModelMerger.java @@ -120,12 +120,13 @@ public class MavenModelMerger Map context ) { Organization src = source.getOrganization(); - if ( source.getOrganization() != null ) + if ( src != null ) { Organization tgt = target.getOrganization(); if ( tgt == null ) { tgt = new Organization(); + tgt.setLocation( "", src.getLocation( "" ) ); target.setOrganization( tgt ); mergeOrganization( tgt, src, sourceDominant, context ); } @@ -137,12 +138,13 @@ public class MavenModelMerger Map context ) { IssueManagement src = source.getIssueManagement(); - if ( source.getIssueManagement() != null ) + if ( src != null ) { IssueManagement tgt = target.getIssueManagement(); if ( tgt == null ) { tgt = new IssueManagement(); + tgt.setLocation( "", src.getLocation( "" ) ); target.setIssueManagement( tgt ); mergeIssueManagement( tgt, src, sourceDominant, context ); } @@ -154,12 +156,13 @@ public class MavenModelMerger Map context ) { CiManagement src = source.getCiManagement(); - if ( source.getCiManagement() != null ) + if ( src != null ) { CiManagement tgt = target.getCiManagement(); if ( tgt == null ) { tgt = new CiManagement(); + tgt.setLocation( "", src.getLocation( "" ) ); target.setCiManagement( tgt ); mergeCiManagement( tgt, src, sourceDominant, context ); } @@ -367,6 +370,7 @@ public class MavenModelMerger if ( sourceDominant || tgt == null ) { tgt = new DeploymentRepository(); + tgt.setLocation( "", src.getLocation( "" ) ); target.setRepository( tgt ); mergeDeploymentRepository( tgt, src, sourceDominant, context ); } @@ -386,6 +390,7 @@ public class MavenModelMerger if ( sourceDominant || tgt == null ) { tgt = new DeploymentRepository(); + tgt.setLocation( "", src.getLocation( "" ) ); target.setSnapshotRepository( tgt ); mergeDeploymentRepository( tgt, src, sourceDominant, context ); } @@ -403,6 +408,7 @@ public class MavenModelMerger if ( sourceDominant || tgt == null ) { tgt = new Site(); + tgt.setLocation( "", src.getLocation( "" ) ); target.setSite( tgt ); mergeSite( tgt, src, sourceDominant, context ); } 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 1d3b3d7bc6..6e2f3f1da2 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 @@ -155,7 +155,7 @@ public class ModelMerger protected void mergeModel_Parent( Model target, Model source, boolean sourceDominant, Map context ) { Parent src = source.getParent(); - if ( source.getParent() != null ) + if ( src != null ) { Parent tgt = target.getParent(); if ( tgt == null ) @@ -281,7 +281,7 @@ public class ModelMerger Map context ) { Organization src = source.getOrganization(); - if ( source.getOrganization() != null ) + if ( src != null ) { Organization tgt = target.getOrganization(); if ( tgt == null ) @@ -409,7 +409,7 @@ public class ModelMerger Map context ) { IssueManagement src = source.getIssueManagement(); - if ( source.getIssueManagement() != null ) + if ( src != null ) { IssueManagement tgt = target.getIssueManagement(); if ( tgt == null ) @@ -424,7 +424,7 @@ public class ModelMerger protected void mergeModel_Scm( Model target, Model source, boolean sourceDominant, Map context ) { Scm src = source.getScm(); - if ( source.getScm() != null ) + if ( src != null ) { Scm tgt = target.getScm(); if ( tgt == null ) @@ -440,7 +440,7 @@ public class ModelMerger Map context ) { CiManagement src = source.getCiManagement(); - if ( source.getCiManagement() != null ) + if ( src != null ) { CiManagement tgt = target.getCiManagement(); if ( tgt == null ) @@ -456,7 +456,7 @@ public class ModelMerger Map context ) { Prerequisites src = source.getPrerequisites(); - if ( source.getPrerequisites() != null ) + if ( src != null ) { Prerequisites tgt = target.getPrerequisites(); if ( tgt == null ) @@ -471,7 +471,7 @@ public class ModelMerger protected void mergeModel_Build( Model target, Model source, boolean sourceDominant, Map context ) { Build src = source.getBuild(); - if ( source.getBuild() != null ) + if ( src != null ) { Build tgt = target.getBuild(); if ( tgt == null ) @@ -626,7 +626,7 @@ public class ModelMerger Map context ) { DistributionManagement src = source.getDistributionManagement(); - if ( source.getDistributionManagement() != null ) + if ( src != null ) { DistributionManagement tgt = target.getDistributionManagement(); if ( tgt == null ) @@ -642,7 +642,7 @@ public class ModelMerger Map context ) { Reporting src = source.getReporting(); - if ( source.getReporting() != null ) + if ( src != null ) { Reporting tgt = target.getReporting(); if ( tgt == null ) @@ -658,7 +658,7 @@ public class ModelMerger Map context ) { DependencyManagement src = source.getDependencyManagement(); - if ( source.getDependencyManagement() != null ) + if ( src != null ) { DependencyManagement tgt = target.getDependencyManagement(); if ( tgt == null ) @@ -2440,7 +2440,7 @@ public class ModelMerger boolean sourceDominant, Map context ) { PluginManagement src = source.getPluginManagement(); - if ( source.getPluginManagement() != null ) + if ( src != null ) { PluginManagement tgt = target.getPluginManagement(); if ( tgt == null )