You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2016/09/10 13:32:54 UTC
maven git commit: MNG-5951 MNG-6059 inherit added attributes
Repository: maven
Updated Branches:
refs/heads/master 6ae831c22 -> 7e1fe622d
MNG-5951 MNG-6059 inherit added attributes
Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/7e1fe622
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/7e1fe622
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/7e1fe622
Branch: refs/heads/master
Commit: 7e1fe622d284d7b7319bf109f83bf8bd11b62829
Parents: 6ae831c
Author: Herv� Boutemy <hb...@apache.org>
Authored: Sat Sep 10 15:32:49 2016 +0200
Committer: Herv� Boutemy <hb...@apache.org>
Committed: Sat Sep 10 15:32:49 2016 +0200
----------------------------------------------------------------------
maven-model-builder/src/site/apt/index.apt | 2 +-
.../inheritance/no-append-urls-expected.xml | 9 ++-
.../apache/maven/model/merge/ModelMerger.java | 81 ++++++++++++++++++++
3 files changed, 88 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven/blob/7e1fe622/maven-model-builder/src/site/apt/index.apt
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/site/apt/index.apt b/maven-model-builder/src/site/apt/index.apt
index 70ae999..74fa041 100644
--- a/maven-model-builder/src/site/apt/index.apt
+++ b/maven-model-builder/src/site/apt/index.apt
@@ -139,7 +139,7 @@ Maven Model Builder
<<<...@child.project.url.inherit.append.path>>>,
<<<...@child.site.url.inherit.append.path>>>,
<<<...@child.scm.connection.inherit.append.path>>>,
- <<<...@child.scm.developperConnection.inherit.append.path>>> and
+ <<<...@child.scm.developerConnection.inherit.append.path>>> and
<<<...@child.scm.url.inherit.append.path>>>.
[]
http://git-wip-us.apache.org/repos/asf/maven/blob/7e1fe622/maven-model-builder/src/test/resources/poms/inheritance/no-append-urls-expected.xml
----------------------------------------------------------------------
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..be57821 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.
-->
<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">
+ 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">
<modelVersion>4.0.0</modelVersion>
<parent>
@@ -37,13 +38,15 @@ under the License.
<!-- 5 inherited urls without anything added to parent -->
<url>http://www.apache.org/path/to/parent/</url>
- <scm>
+ <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>
+ <site child.site.url.inherit.append.path="false">
<url>scp://scp.domain.org/base/</url>
</site>
</distributionManagement>
http://git-wip-us.apache.org/repos/asf/maven/blob/7e1fe622/maven-model/src/main/java/org/apache/maven/model/merge/ModelMerger.java
----------------------------------------------------------------------
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 6bdb54f..340ad15 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
@@ -129,6 +129,7 @@ public class ModelMerger
mergeModel_Parent( target, source, sourceDominant, context );
mergeModel_GroupId( target, source, sourceDominant, context );
mergeModel_ArtifactId( target, source, sourceDominant, context );
+ mergeModel_ChildProjectUrlInheritAppendPath( target, source, sourceDominant, context );
mergeModel_Version( target, source, sourceDominant, context );
mergeModel_Packaging( target, source, sourceDominant, context );
mergeModel_Name( target, source, sourceDominant, context );
@@ -206,6 +207,21 @@ public class ModelMerger
}
}
+ protected void mergeModel_ChildProjectUrlInheritAppendPath( Model target, Model source, boolean sourceDominant,
+ Map<Object, Object> 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<Object, Object> context )
{
@@ -876,11 +892,27 @@ public class ModelMerger
protected void mergeSite( Site target, Site source, boolean sourceDominant, Map<Object, Object> 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<Object, Object> 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<Object, Object> context )
{
String src = source.getId();
@@ -1925,12 +1957,61 @@ public class ModelMerger
protected void mergeScm( Scm target, Scm source, boolean sourceDominant, Map<Object, Object> 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<Object, Object> 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<Object, Object> 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<Object, Object> 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<Object, Object> context )
{
String src = source.getUrl();