diff --git a/maven-model-builder/src/test/resources/poms/inheritance/no-append-urls-expected.xml b/maven-model-builder/src/test/resources/poms/inheritance/no-append-urls-expected.xml index cde7dfe48c..e6f5ac4c5b 100644 --- a/maven-model-builder/src/test/resources/poms/inheritance/no-append-urls-expected.xml +++ b/maven-model-builder/src/test/resources/poms/inheritance/no-append-urls-expected.xml @@ -20,7 +20,8 @@ under the License. --> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" + child.project.url.inherit.append.path="false"> 4.0.0 @@ -37,13 +38,15 @@ under the License. http://www.apache.org/path/to/parent/ - + scm:my-scm:http://domain.org/base scm:my-scm:https://domain.org/base/ https://domain.org/base - + scp://scp.domain.org/base/ 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 e10ce0f2dd..5848f59e51 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 @@ -125,6 +125,7 @@ public class ModelMerger { mergeModelBase( target, source, sourceDominant, context ); + mergeModel_ChildProjectUrlInheritAppendPath( target, source, sourceDominant, context ); mergeModel_ModelVersion( target, source, sourceDominant, context ); mergeModel_Parent( target, source, sourceDominant, context ); mergeModel_GroupId( target, source, sourceDominant, context ); @@ -206,6 +207,21 @@ public class ModelMerger } } + protected void mergeModel_ChildProjectUrlInheritAppendPath( Model target, Model source, boolean sourceDominant, + Map context ) + { + String src = source.getChildProjectUrlInheritAppendPath(); + if ( src != null ) + { + if ( sourceDominant || target.getChildProjectUrlInheritAppendPath() == null ) + { + target.setChildProjectUrlInheritAppendPath( src ); + target.setLocation( "child.project.url.inherit.append.path", + source.getLocation( "child.project.url.inherit.append.path" ) ); + } + } + } + protected void mergeModel_Version( Model target, Model source, boolean sourceDominant, Map context ) { @@ -876,11 +892,27 @@ public class ModelMerger protected void mergeSite( Site target, Site source, boolean sourceDominant, Map context ) { + mergeSite_ChildSiteUrlInheritAppendPath( target, source, sourceDominant, context ); mergeSite_Id( target, source, sourceDominant, context ); mergeSite_Name( target, source, sourceDominant, context ); mergeSite_Url( target, source, sourceDominant, context ); } + protected void mergeSite_ChildSiteUrlInheritAppendPath( Site target, Site source, boolean sourceDominant, + Map context ) + { + String src = source.getChildSiteUrlInheritAppendPath(); + if ( src != null ) + { + if ( sourceDominant || target.getChildSiteUrlInheritAppendPath() == null ) + { + target.setChildSiteUrlInheritAppendPath( src ); + target.setLocation( "child.site.url.inherit.append.path", + source.getLocation( "child.site.url.inherit.append.path" ) ); + } + } + } + protected void mergeSite_Id( Site target, Site source, boolean sourceDominant, Map context ) { String src = source.getId(); @@ -1925,12 +1957,61 @@ public class ModelMerger protected void mergeScm( Scm target, Scm source, boolean sourceDominant, Map context ) { + mergeScm_ChildScmConnectionInheritAppendPath( target, source, sourceDominant, context ); + mergeScm_ChildScmDeveloperConnectionInheritAppendPath( target, source, sourceDominant, context ); + mergeScm_ChildScmUrlInheritAppendPath( target, source, sourceDominant, context ); mergeScm_Url( target, source, sourceDominant, context ); mergeScm_Connection( target, source, sourceDominant, context ); mergeScm_DeveloperConnection( target, source, sourceDominant, context ); mergeScm_Tag( target, source, sourceDominant, context ); } + protected void mergeScm_ChildScmConnectionInheritAppendPath( Scm target, Scm source, boolean sourceDominant, + Map context ) + { + String src = source.getChildScmConnectionInheritAppendPath(); + if ( src != null ) + { + if ( sourceDominant || target.getChildScmConnectionInheritAppendPath() == null ) + { + target.setChildScmConnectionInheritAppendPath( src ); + target.setLocation( "child.scm.connection.inherit.append.path", + source.getLocation( "child.scm.connection.inherit.append.path" ) ); + } + } + } + + protected void mergeScm_ChildScmDeveloperConnectionInheritAppendPath( Scm target, Scm source, + boolean sourceDominant, + Map context ) + { + String src = source.getChildScmDeveloperConnectionInheritAppendPath(); + if ( src != null ) + { + if ( sourceDominant || target.getChildScmDeveloperConnectionInheritAppendPath() == null ) + { + target.setChildScmDeveloperConnectionInheritAppendPath( src ); + target.setLocation( "child.scm.developerConnection.inherit.append.path", + source.getLocation( "child.scm.developerConnection.inherit.append.path" ) ); + } + } + } + + protected void mergeScm_ChildScmUrlInheritAppendPath( Scm target, Scm source, boolean sourceDominant, + Map context ) + { + String src = source.getChildScmUrlInheritAppendPath(); + if ( src != null ) + { + if ( sourceDominant || target.getChildScmUrlInheritAppendPath() == null ) + { + target.setChildScmUrlInheritAppendPath( src ); + target.setLocation( "child.scm.url.inherit.append.path", + source.getLocation( "child.scm.url.inherit.append.path" ) ); + } + } + } + protected void mergeScm_Url( Scm target, Scm source, boolean sourceDominant, Map context ) { String src = source.getUrl();