I just checked this commit through core ITs and everything went well Any objection if I merge it to master now, before the Maven 3.3.7 release?
Regards, Hervé Le jeudi 13 août 2015 00:38:43 [email protected] a écrit : > Repository: maven > Updated Branches: > refs/heads/MNG-5871 [created] 48ae9fd4a > > > MNG-5871 refactoring: put url extrapolation algorithm in inheritance > model merger > > Project: http://git-wip-us.apache.org/repos/asf/maven/repo > Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/48ae9fd4 > Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/48ae9fd4 > Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/48ae9fd4 > > Branch: refs/heads/MNG-5871 > Commit: 48ae9fd4af5be45c50aa6164dba96d254e902564 > Parents: 7f21ebe > Author: Hervé Boutemy <[email protected]> > Authored: Thu Aug 13 02:36:59 2015 +0200 > Committer: Hervé Boutemy <[email protected]> > Committed: Thu Aug 13 02:36:59 2015 +0200 > > ---------------------------------------------------------------------- > .../DefaultInheritanceAssembler.java | 54 +++++++++++++++++ > .../maven/model/merge/MavenModelMerger.java | 63 +++----------------- > 2 files changed, 62 insertions(+), 55 deletions(-) > ---------------------------------------------------------------------- > > > http://git-wip-us.apache.org/repos/asf/maven/blob/48ae9fd4/maven-model-build > er/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssemb > ler.java > ---------------------------------------------------------------------- diff > --git > a/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/Defa > ultInheritanceAssembler.java > b/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/Defa > ultInheritanceAssembler.java index 3b812ea..48fdad5 100644 > --- > a/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/Defa > ultInheritanceAssembler.java +++ > b/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/Defa > ultInheritanceAssembler.java @@ -131,6 +131,60 @@ public class > DefaultInheritanceAssembler > { > > @Override > + protected String extrapolateChildUrl( String parentUrl, Map<Object, > Object> context ) + { > + Object artifactId = context.get( ARTIFACT_ID ); > + Object childPathAdjustment = context.get( CHILD_PATH_ADJUSTMENT > ); + > + if ( artifactId != null && childPathAdjustment != null ) > + { > + // append childPathAdjustment and artifactId to parent url > + return appendPath( parentUrl, artifactId.toString(), > childPathAdjustment.toString() ); + } > + else > + { > + return parentUrl; > + } > + } > + > + private String appendPath( String parentUrl, String childPath, > String pathAdjustment ) + { > + String url = parentUrl; > + url = concatPath( url, pathAdjustment ); > + url = concatPath( url, childPath ); > + return url; > + } > + > + private String concatPath( String base, String path ) > + { > + String result = base; > + > + if ( path != null && path.length() > 0 ) > + { > + if ( ( result.endsWith( "/" ) && !path.startsWith( "/" ) ) > + || ( !result.endsWith( "/" ) && path.startsWith( "/" ) > ) ) + { > + result += path; > + } > + else if ( result.endsWith( "/" ) && path.startsWith( "/" ) > ) + { > + result += path.substring( 1 ); > + } > + else > + { > + result += '/'; > + result += path; > + } > + if ( base.endsWith( "/" ) && !result.endsWith( "/" ) ) > + { > + result += '/'; > + } > + } > + > + return result; > + } > + > + @Override > protected void mergePluginContainer_Plugins( PluginContainer > target, PluginContainer source, boolean sourceDominant, Map<Object, Object> > context ) { > > http://git-wip-us.apache.org/repos/asf/maven/blob/48ae9fd4/maven-model-build > er/src/main/java/org/apache/maven/model/merge/MavenModelMerger.java > ---------------------------------------------------------------------- diff > --git > a/maven-model-builder/src/main/java/org/apache/maven/model/merge/MavenModel > Merger.java > b/maven-model-builder/src/main/java/org/apache/maven/model/merge/MavenModel > Merger.java index 66577cb..0007af5 100644 > --- > a/maven-model-builder/src/main/java/org/apache/maven/model/merge/MavenModel > Merger.java +++ > b/maven-model-builder/src/main/java/org/apache/maven/model/merge/MavenModel > Merger.java @@ -65,7 +65,7 @@ public class MavenModelMerger > /** > * The context key for the artifact id of the target model. > */ > - private static final String ARTIFACT_ID = "artifact-id"; > + public static final String ARTIFACT_ID = "artifact-id"; > > @Override > protected void mergeModel( Model target, Model source, boolean > sourceDominant, Map<Object, Object> context ) @@ -102,7 +102,7 @@ public > class MavenModelMerger > } > else if ( target.getUrl() == null ) > { > - target.setUrl( appendPath( src, context ) ); > + target.setUrl( extrapolateChildUrl( src, context ) ); > target.setLocation( "url", source.getLocation( "url" ) ); > } > } > @@ -466,7 +466,7 @@ public class MavenModelMerger > } > else if ( target.getUrl() == null ) > { > - target.setUrl( appendPath( src, context ) ); > + target.setUrl( extrapolateChildUrl( src, context ) ); > target.setLocation( "url", source.getLocation( "url" ) ); > } > } > @@ -485,7 +485,7 @@ public class MavenModelMerger > } > else if ( target.getUrl() == null ) > { > - target.setUrl( appendPath( src, context ) ); > + target.setUrl( extrapolateChildUrl( src, context ) ); > target.setLocation( "url", source.getLocation( "url" ) ); > } > } > @@ -504,7 +504,7 @@ public class MavenModelMerger > } > else if ( target.getConnection() == null ) > { > - target.setConnection( appendPath( src, context ) ); > + target.setConnection( extrapolateChildUrl( src, context ) > ); target.setLocation( "connection", source.getLocation( "connection" ) ); > } > } > @@ -524,7 +524,7 @@ public class MavenModelMerger > } > else if ( target.getDeveloperConnection() == null ) > { > - target.setDeveloperConnection( appendPath( src, context ) > ); + target.setDeveloperConnection( extrapolateChildUrl( > src, context ) ); target.setLocation( "developerConnection", > source.getLocation( "developerConnection" ) ); } > } > @@ -670,56 +670,9 @@ public class MavenModelMerger > return exclusion.getGroupId() + ':' + exclusion.getArtifactId(); > } > > - private String appendPath( String parentPath, Map<Object, Object> > context ) + protected String extrapolateChildUrl( String parentUrl, > Map<Object, Object> context ) { > - Object artifactId = context.get( ARTIFACT_ID ); > - Object childPathAdjustment = context.get( CHILD_PATH_ADJUSTMENT ); > - > - if ( artifactId != null && childPathAdjustment != null ) > - { > - return appendPath( parentPath, artifactId.toString(), > childPathAdjustment.toString() ); - } > - else > - { > - return parentPath; > - } > - } > - > - private String appendPath( String parentPath, String childPath, String > pathAdjustment ) - { > - String path = parentPath; > - path = concatPath( path, pathAdjustment ); > - path = concatPath( path, childPath ); > - return path; > - } > - > - private String concatPath( String base, String path ) > - { > - String result = base; > - > - if ( path != null && path.length() > 0 ) > - { > - if ( ( result.endsWith( "/" ) && !path.startsWith( "/" ) ) > - || ( !result.endsWith( "/" ) && path.startsWith( "/" ) ) ) > - { > - result += path; > - } > - else if ( result.endsWith( "/" ) && path.startsWith( "/" ) ) > - { > - result += path.substring( 1 ); > - } > - else > - { > - result += '/'; > - result += path; > - } > - if ( base.endsWith( "/" ) && !result.endsWith( "/" ) ) > - { > - result += '/'; > - } > - } > - > - return result; > + return parentUrl; > } > > } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
