maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hbout...@apache.org
Subject [maven] 01/03: [MNG-6059] renamed attributes to get more flexibility for scm urls
Date Sun, 11 Nov 2018 18:30:56 GMT
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven.git

commit db462ae0b3d36928c6a5938469a223c0d3c4ab50
Author: Hervé Boutemy <hboutemy@apache.org>
AuthorDate: Thu Nov 1 23:58:22 2018 +0100

    [MNG-6059] renamed attributes to get more flexibility for scm urls
---
 .../apache/maven/model/merge/MavenModelMerger.java |  19 ++--
 maven-model-builder/src/site/apt/index.apt         |   8 ++
 .../DefaultInheritanceAssemblerTest.java           |   2 +-
 .../poms/inheritance/no-append-urls-expected.xml   |   2 +-
 .../poms/inheritance/no-append-urls-parent.xml     |  10 +-
 maven-model/src/main/mdo/maven.mdo                 | 117 ++++++++++++++++-----
 6 files changed, 114 insertions(+), 44 deletions(-)

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 640c211..a1449ac 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 @@ import org.apache.maven.model.Site;
  *
  * @author Benjamin Bentmann
  */
-@SuppressWarnings( { "checkstyle:methodname" } )
 public class MavenModelMerger
     extends ModelMerger
 {
@@ -103,14 +102,14 @@ public class MavenModelMerger
             }
             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 @@ public class MavenModelMerger
     }
 
     /*
-     * 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 @@ public class MavenModelMerger
     }
 
     /*
-     * 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 @@ public class MavenModelMerger
             }
             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 @@ public class MavenModelMerger
             }
             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 @@ public class MavenModelMerger
             }
             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 @@ public class MavenModelMerger
             }
             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 a14b4e3..25e9f71 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
+  <<<false>>> for each url:
+  <<<project/@child.project.url.inherit.append.path>>>,
+  <<<project/distributionManagement/site/@child.site.url.inherit.append.path>>>,
+  <<<project/scm/@child.scm.connection.inherit.append.path>>>,
+  <<<project/scm/@child.scm.developerConnection.inherit.append.path>>>
and
+  <<<project/scm/@child.scm.url.inherit.append.path>>>.
+
   []
 
 * 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 cabe1a5..b97f37c 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 class DefaultInheritanceAssemblerTest
     }
 
     /**
-     * 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 d2a8cfe..cde7dfe 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.
   <artifactId>inheritance</artifactId>
   <version>11-SNAPSHOT</version>
   <name>Model urls inheritance test child</name>
-  <description>MNG-5951 child.inherit.append.path="false" for each url to avoid automatic
path addition when inheriting</description>
+  <description>MNG-5951 MNG-6059 child.x.y.inherit.append.path="false" for each url
to avoid automatic path addition when inheriting</description>
 
   <!-- 5 inherited urls without anything added to parent -->
   <url>http://www.apache.org/path/to/parent/</url>
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 e8bc165..8c964cf 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.
 
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
-  child.inherit.append.path="false">
+  child.project.url.inherit.append.path="false">
   <modelVersion>4.0.0</modelVersion>
 
   <groupId>inheritance</groupId>
@@ -29,7 +29,7 @@ under the License.
   <version>11-SNAPSHOT</version>
 
   <name>Model urls inheritance test parent</name>
-  <description>MNG-5951 child.inherit.append.path="false" for each url to avoid automatic
path addition when inheriting</description>
+  <description>MNG-5951 MNG-6059 child.x.y.inherit.append.path="false" for each url
to avoid automatic path addition when inheriting</description>
 
   <modules>
     <module>../inheritance</module>
@@ -37,13 +37,15 @@ under the License.
 
   <!-- 5 urls in the pom to configure for not adding path -->
   <url>http://www.apache.org/path/to/parent/</url>
-  <scm child.inherit.append.path="false">
+  <scm child.scm.connection.inherit.append.path="false"
+       child.scm.developerConnection.inherit.append.path="false"
+       child.scm.url.inherit.append.path="false">
     <connection>scm:my-scm:http://domain.org/base</connection>
     <developerConnection>scm:my-scm:https://domain.org/base/</developerConnection>
     <url>https://domain.org/base</url>
   </scm>
   <distributionManagement>
-    <site child.inherit.append.path="false">
+    <site child.site.url.inherit.append.path="false">
       <url>scp://scp.domain.org/base/</url>
     </site>
   </distributionManagement>
diff --git a/maven-model/src/main/mdo/maven.mdo b/maven-model/src/main/mdo/maven.mdo
index 959c653..517ea5e 100644
--- a/maven-model/src/main/mdo/maven.mdo
+++ b/maven-model/src/main/mdo/maven.mdo
@@ -184,21 +184,22 @@
           <description>
             <![CDATA[
             The URL to the project's homepage.
-            <br><b>Default value is</b>: parent value [+ path adjustment]
+ (artifactId or <code>project.directory</code> property), or just parent value
if 
-            <code>child.urls.inherit.append.path="false"</code>
+            <br /><b>Default value is</b>: parent value [+ path adjustment]
+ (artifactId or project.directory property), or just parent value if
+            project's <code>child.project.url.inherit.append.path="false"</code>
             ]]>
           </description>
           <type>String</type>
         </field>
-        <field xml.attribute="true" xml.tagName="child.inherit.append.path">
-          <name>childInheritAppendPath</name>
+        <field xml.attribute="true" xml.tagName="child.project.url.inherit.append.path">
+          <name>childProjectUrlInheritAppendPath</name>
           <version>4.0.0+</version>
           <description>
             <![CDATA[
-            When childs inherit from urls, append path or not?. Note: While the type
+            When childs inherit from project's url, append path or not? Note: While the type
             of this field is <code>String</code> for technical reasons, the semantic
type is actually
             <code>Boolean</code>
             <br /><b>Default value is</b>: <code>true</code>
+            <br /><b>Since</b>: Maven 3.6.1
             ]]>
           </description>
           <type>String</type>
@@ -422,15 +423,17 @@
           <version>4.0.0+</version>
           <code>
             <![CDATA[
-    public boolean isChildInheritAppendPath()
+
+    public boolean isChildProjectUrlInheritAppendPath()
     {
-        return ( childInheritAppendPath != null ) ? Boolean.parseBoolean( childInheritAppendPath
) : true;
+        return ( childProjectUrlInheritAppendPath != null ) ? Boolean.parseBoolean( childProjectUrlInheritAppendPath
) : true;
     }
 
-    public void setChildInheritAppendPath( boolean childInheritAppendPath )
+    public void setChildProjectUrlInheritAppendPath( boolean childProjectUrlInheritAppendPath
)
     {
-        this.childInheritAppendPath = String.valueOf( childInheritAppendPath );
+        this.childProjectUrlInheritAppendPath = String.valueOf( childProjectUrlInheritAppendPath
);
     }
+
             ]]>
           </code>
         </codeSegment>
@@ -1613,7 +1616,8 @@
             <a href="https://maven.apache.org/scm/scm-url-format.html">URL format</a>
             and <a href="https://maven.apache.org/scm/scms-overview.html">list of supported
SCMs</a>.
             This connection is read-only.
-            <br><b>Default value is</b>: parent value [+ path adjustment]
+ (artifactId or <code>project.directory</code> property) 
+            <br /><b>Default value is</b>: parent value [+ path adjustment]
+ (artifactId or project.directory property), or just parent value if
+            scm's <code>child.scm.connection.inherit.append.path="false"</code>
             ]]>
           </description>
           <type>String</type>
@@ -1625,7 +1629,8 @@
             <![CDATA[
             Just like <code>connection</code>, but for developers, i.e. this
scm connection
             will not be read only.
-            <br><b>Default value is</b>: parent value [+ path adjustment]
+ (artifactId or <code>project.directory</code> property)
+            <br /><b>Default value is</b>: parent value [+ path adjustment]
+ (artifactId or project.directory property), or just parent value if
+            scm's <code>child.scm.developerConnection.inherit.append.path="false"</code>
             ]]>
           </description>
           <type>String</type>
@@ -1643,21 +1648,50 @@
           <description>
             <![CDATA[
             The URL to the project's browsable SCM repository, such as ViewVC or Fisheye.
-            <br><b>Default value is</b>: parent value [+ path adjustment]
+ (artifactId or <code>project.directory</code> property), or just parent value
if 
-            <code>child.urls.inherit.append.path="false"</code>
+            <br /><b>Default value is</b>: parent value [+ path adjustment]
+ (artifactId or project.directory property), or just parent value if
+            scm's <code>child.scm.url.inherit.append.path="false"</code>
+            ]]>
+          </description>
+          <type>String</type>
+        </field>
+        <field xml.attribute="true" xml.tagName="child.scm.connection.inherit.append.path">
+          <name>childScmConnectionInheritAppendPath</name>
+          <version>4.0.0+</version>
+          <description>
+            <![CDATA[
+            When childs inherit from scm connection, append path or not? Note: While the
type
+            of this field is <code>String</code> for technical reasons, the semantic
type is actually
+            <code>Boolean</code>
+            <br /><b>Default value is</b>: <code>true</code>
+            <br /><b>Since</b>: Maven 3.6.1
+            ]]>
+          </description>
+          <type>String</type>
+        </field>
+        <field xml.attribute="true" xml.tagName="child.scm.developerConnection.inherit.append.path">
+          <name>childScmDeveloperConnectionInheritAppendPath</name>
+          <version>4.0.0+</version>
+          <description>
+            <![CDATA[
+            When childs inherit from scm developer connection, append path or not? Note:
While the type
+            of this field is <code>String</code> for technical reasons, the semantic
type is actually
+            <code>Boolean</code>
+            <br /><b>Default value is</b>: <code>true</code>
+            <br /><b>Since</b>: Maven 3.6.1
             ]]>
           </description>
           <type>String</type>
         </field>
-        <field xml.attribute="true" xml.tagName="child.inherit.append.path">
-          <name>childInheritAppendPath</name>
+        <field xml.attribute="true" xml.tagName="child.scm.url.inherit.append.path">
+          <name>childScmUrlInheritAppendPath</name>
           <version>4.0.0+</version>
           <description>
             <![CDATA[
-            When childs inherit from urls, append path or not?. Note: While the type
+            When childs inherit from scm url, append path or not? Note: While the type
             of this field is <code>String</code> for technical reasons, the semantic
type is actually
             <code>Boolean</code>
             <br /><b>Default value is</b>: <code>true</code>
+            <br /><b>Since</b>: Maven 3.6.1
             ]]>
           </description>
           <type>String</type>
@@ -1668,15 +1702,37 @@
           <version>4.0.0+</version>
           <code>
             <![CDATA[
-    public boolean isChildInheritAppendPath()
+
+    public boolean isChildScmConnectionInheritAppendPath()
+    {
+        return ( childScmConnectionInheritAppendPath != null ) ? Boolean.parseBoolean( childScmConnectionInheritAppendPath
) : true;
+    }
+
+    public void setChildScmConnectionInheritAppendPath( boolean childScmConnectionInheritAppendPath
)
+    {
+        this.childScmConnectionInheritAppendPath = String.valueOf( childScmConnectionInheritAppendPath
);
+    }
+
+    public boolean isChildScmDeveloperConnectionInheritAppendPath()
     {
-        return ( childInheritAppendPath != null ) ? Boolean.parseBoolean( childInheritAppendPath
) : true;
+        return ( childScmDeveloperConnectionInheritAppendPath != null ) ? Boolean.parseBoolean(
childScmDeveloperConnectionInheritAppendPath ) : true;
     }
 
-    public void setChildInheritAppendPath( boolean childInheritAppendPath )
+    public void setChildScmDeveloperConnectionInheritAppendPath( boolean childScmDeveloperConnectionInheritAppendPath
)
     {
-        this.childInheritAppendPath = String.valueOf( childInheritAppendPath );
+        this.childScmDeveloperConnectionInheritAppendPath = String.valueOf( childScmDeveloperConnectionInheritAppendPath
);
     }
+
+    public boolean isChildScmUrlInheritAppendPath()
+    {
+        return ( childScmUrlInheritAppendPath != null ) ? Boolean.parseBoolean( childScmUrlInheritAppendPath
) : true;
+    }
+
+    public void setChildScmUrlInheritAppendPath( boolean childScmUrlInheritAppendPath )
+    {
+        this.childScmUrlInheritAppendPath = String.valueOf( childScmUrlInheritAppendPath
);
+    }
+
             ]]>
           </code>
         </codeSegment>
@@ -2000,21 +2056,22 @@
           <description>
             <![CDATA[
             The url of the location where website is deployed, in the form <code>protocol://hostname/path</code>.
-            <br><b>Default value is</b>: parent value [+ path adjustment]
+ (artifactId or <code>project.directory</code> property), or just parent value
if 
-            <code>child.urls.inherit.append.path="false"</code>
+            <br /><b>Default value is</b>: parent value [+ path adjustment]
+ (artifactId or project.directory property), or just parent value if
+            site's <code>child.site.url.inherit.append.path="false"</code>
             ]]>
           </description>
           <type>String</type>
         </field>
-        <field xml.attribute="true" xml.tagName="child.inherit.append.path">
-          <name>childInheritAppendPath</name>
+        <field xml.attribute="true" xml.tagName="child.site.url.inherit.append.path">
+          <name>childSiteUrlInheritAppendPath</name>
           <version>4.0.0+</version>
           <description>
             <![CDATA[
-            When childs inherit from urls, append path or not?. Note: While the type
+            When childs inherit from distribution management site url, append path or not?
Note: While the type
             of this field is <code>String</code> for technical reasons, the semantic
type is actually
             <code>Boolean</code>
             <br /><b>Default value is</b>: <code>true</code>
+            <br /><b>Since</b>: Maven 3.6.1
             ]]>
           </description>
           <type>String</type>
@@ -2025,15 +2082,17 @@
           <version>4.0.0+</version>
           <code>
             <![CDATA[
-    public boolean isChildInheritAppendPath()
+
+    public boolean isChildSiteUrlInheritAppendPath()
     {
-        return ( childInheritAppendPath != null ) ? Boolean.parseBoolean( childInheritAppendPath
) : true;
+        return ( childSiteUrlInheritAppendPath != null ) ? Boolean.parseBoolean( childSiteUrlInheritAppendPath
) : true;
     }
 
-    public void setChildInheritAppendPath( boolean childInheritAppendPath )
+    public void setChildSiteUrlInheritAppendPath( boolean childSiteUrlInheritAppendPath )
     {
-        this.childInheritAppendPath = String.valueOf( childInheritAppendPath );
+        this.childSiteUrlInheritAppendPath = String.valueOf( childSiteUrlInheritAppendPath
);
     }
+
             ]]>
           </code>
         </codeSegment>


Mime
View raw message