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 640c211b79..a1449ace89 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 @@ -53,7 +53,6 @@ * * @author Benjamin Bentmann */ -@SuppressWarnings( { "checkstyle:methodname" } ) public class MavenModelMerger extends ModelMerger { @@ -103,14 +102,14 @@ protected void mergeModel_Url( Model target, Model source, boolean sourceDominan } else if ( target.getUrl() == null ) { - target.setUrl( extrapolateChildUrl( src, source.isChildInheritAppendPath(), context ) ); + target.setUrl( extrapolateChildUrl( src, source.isChildProjectUrlInheritAppendPath(), context ) ); target.setLocation( "url", source.getLocation( "url" ) ); } } } /* - * TODO Whether the merge continues recursively into an existing node or not could be an option for the generated + * TODO: Whether the merge continues recursively into an existing node or not could be an option for the generated * merger */ @Override @@ -267,7 +266,7 @@ protected void mergeModelBase_Modules( ModelBase target, ModelBase source, boole } /* - * TODO The order of the merged list could be controlled by an attribute in the model association: target-first, + * TODO: The order of the merged list could be controlled by an attribute in the model association: target-first, * source-first, dominant-first, recessive-first */ @Override @@ -353,7 +352,7 @@ protected void mergeModelBase_PluginRepositories( ModelBase target, ModelBase so } /* - * TODO Whether duplicates should be removed looks like an option for the generated merger. + * TODO: Whether duplicates should be removed looks like an option for the generated merger. */ @Override protected void mergeBuildBase_Filters( BuildBase target, BuildBase source, boolean sourceDominant, @@ -467,7 +466,7 @@ protected void mergeSite_Url( Site target, Site source, boolean sourceDominant, } else if ( target.getUrl() == null ) { - target.setUrl( extrapolateChildUrl( src, source.isChildInheritAppendPath(), context ) ); + target.setUrl( extrapolateChildUrl( src, source.isChildSiteUrlInheritAppendPath(), context ) ); target.setLocation( "url", source.getLocation( "url" ) ); } } @@ -486,7 +485,7 @@ protected void mergeScm_Url( Scm target, Scm source, boolean sourceDominant, Map } else if ( target.getUrl() == null ) { - target.setUrl( extrapolateChildUrl( src, source.isChildInheritAppendPath(), context ) ); + target.setUrl( extrapolateChildUrl( src, source.isChildScmUrlInheritAppendPath(), context ) ); target.setLocation( "url", source.getLocation( "url" ) ); } } @@ -505,7 +504,8 @@ protected void mergeScm_Connection( Scm target, Scm source, boolean sourceDomina } else if ( target.getConnection() == null ) { - target.setConnection( extrapolateChildUrl( src, source.isChildInheritAppendPath(), context ) ); + target.setConnection( extrapolateChildUrl( src, source.isChildScmConnectionInheritAppendPath(), + context ) ); target.setLocation( "connection", source.getLocation( "connection" ) ); } } @@ -525,7 +525,8 @@ protected void mergeScm_DeveloperConnection( Scm target, Scm source, boolean sou } else if ( target.getDeveloperConnection() == null ) { - target.setDeveloperConnection( extrapolateChildUrl( src, source.isChildInheritAppendPath(), context ) ); + String e = extrapolateChildUrl( src, source.isChildScmDeveloperConnectionInheritAppendPath(), context ); + target.setDeveloperConnection( e ); target.setLocation( "developerConnection", source.getLocation( "developerConnection" ) ); } } diff --git a/maven-model-builder/src/site/apt/index.apt b/maven-model-builder/src/site/apt/index.apt index a14b4e3369..25e9f71fee 100644 --- a/maven-model-builder/src/site/apt/index.apt +++ b/maven-model-builder/src/site/apt/index.apt @@ -132,6 +132,14 @@ Maven Model Builder property is not inherited from a POM to its child: childs POM will use child artifact id if property is not set. + ** since Maven 3.6.1, inheritance can avoid appending any path to parent value by setting model attribute value to + <<>> for each url: + <<>>, + <<>>, + <<>>, + <<>> and + <<>>. + [] * Model Interpolation diff --git a/maven-model-builder/src/test/java/org/apache/maven/model/inheritance/DefaultInheritanceAssemblerTest.java b/maven-model-builder/src/test/java/org/apache/maven/model/inheritance/DefaultInheritanceAssemblerTest.java index cabe1a5331..b97f37c9d8 100644 --- a/maven-model-builder/src/test/java/org/apache/maven/model/inheritance/DefaultInheritanceAssemblerTest.java +++ b/maven-model-builder/src/test/java/org/apache/maven/model/inheritance/DefaultInheritanceAssemblerTest.java @@ -94,7 +94,7 @@ public void testFlatUrls() } /** - * MNG-5951 child.inherit.append.path="false" test + * MNG-5951 MNG-6059 child.x.y.inherit.append.path="false" test * @throws Exception */ public void testNoAppendUrls() 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 d2a8cfe52f..cde7dfe48c 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 @@ -33,7 +33,7 @@ under the License. inheritance 11-SNAPSHOT Model urls inheritance test child - MNG-5951 child.inherit.append.path="false" for each url to avoid automatic path addition when inheriting + MNG-5951 MNG-6059 child.x.y.inherit.append.path="false" for each url to avoid automatic path addition when inheriting http://www.apache.org/path/to/parent/ diff --git a/maven-model-builder/src/test/resources/poms/inheritance/no-append-urls-parent.xml b/maven-model-builder/src/test/resources/poms/inheritance/no-append-urls-parent.xml index e8bc1652a4..8c964cf97c 100644 --- a/maven-model-builder/src/test/resources/poms/inheritance/no-append-urls-parent.xml +++ b/maven-model-builder/src/test/resources/poms/inheritance/no-append-urls-parent.xml @@ -21,7 +21,7 @@ under the License. + child.project.url.inherit.append.path="false"> 4.0.0 inheritance @@ -29,7 +29,7 @@ under the License. 11-SNAPSHOT Model urls inheritance test parent - MNG-5951 child.inherit.append.path="false" for each url to avoid automatic path addition when inheriting + MNG-5951 MNG-6059 child.x.y.inherit.append.path="false" for each url to avoid automatic path addition when inheriting ../inheritance @@ -37,13 +37,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/mdo/maven.mdo b/maven-model/src/main/mdo/maven.mdo index 959c653032..517ea5eca3 100644 --- a/maven-model/src/main/mdo/maven.mdo +++ b/maven-model/src/main/mdo/maven.mdo @@ -184,21 +184,22 @@ Default value is: parent value [+ path adjustment] + (artifactId or project.directory property), or just parent value if - child.urls.inherit.append.path="false" +
Default value is: parent value [+ path adjustment] + (artifactId or project.directory property), or just parent value if + project's child.project.url.inherit.append.path="false" ]]>
String - - childInheritAppendPath + + childProjectUrlInheritAppendPath 4.0.0+ String for technical reasons, the semantic type is actually Boolean
Default value is: true +
Since: Maven 3.6.1 ]]>
String @@ -422,15 +423,17 @@ 4.0.0+ @@ -1613,7 +1616,8 @@ URL format and list of supported SCMs. This connection is read-only. -
Default value is: parent value [+ path adjustment] + (artifactId or project.directory property) +
Default value is: parent value [+ path adjustment] + (artifactId or project.directory property), or just parent value if + scm's child.scm.connection.inherit.append.path="false" ]]> String @@ -1625,7 +1629,8 @@ connection, but for developers, i.e. this scm connection will not be read only. -
Default value is: parent value [+ path adjustment] + (artifactId or project.directory property) +
Default value is: parent value [+ path adjustment] + (artifactId or project.directory property), or just parent value if + scm's child.scm.developerConnection.inherit.append.path="false" ]]> String @@ -1643,21 +1648,50 @@ Default value is: parent value [+ path adjustment] + (artifactId or project.directory property), or just parent value if - child.urls.inherit.append.path="false" +
Default value is: parent value [+ path adjustment] + (artifactId or project.directory property), or just parent value if + scm's child.scm.url.inherit.append.path="false" ]]>
String
- - childInheritAppendPath + + childScmConnectionInheritAppendPath 4.0.0+ String for technical reasons, the semantic type is actually Boolean
Default value is: true +
Since: Maven 3.6.1 + ]]> +
+ String +
+ + childScmDeveloperConnectionInheritAppendPath + 4.0.0+ + + String for technical reasons, the semantic type is actually + Boolean +
Default value is: true +
Since: Maven 3.6.1 + ]]> +
+ String +
+ + childScmUrlInheritAppendPath + 4.0.0+ + + String for technical reasons, the semantic type is actually + Boolean +
Default value is: true +
Since: Maven 3.6.1 ]]>
String @@ -1668,15 +1702,37 @@ 4.0.0+ @@ -2000,21 +2056,22 @@ protocol://hostname/path. -
Default value is: parent value [+ path adjustment] + (artifactId or project.directory property), or just parent value if - child.urls.inherit.append.path="false" +
Default value is: parent value [+ path adjustment] + (artifactId or project.directory property), or just parent value if + site's child.site.url.inherit.append.path="false" ]]>
String
- - childInheritAppendPath + + childSiteUrlInheritAppendPath 4.0.0+ String for technical reasons, the semantic type is actually Boolean
Default value is: true +
Since: Maven 3.6.1 ]]>
String @@ -2025,15 +2082,17 @@ 4.0.0+