You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2011/02/20 16:34:42 UTC
svn commit: r1072613 -
/maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java
Author: bentmann
Date: Sun Feb 20 15:34:42 2011
New Revision: 1072613
URL: http://svn.apache.org/viewvc?rev=1072613&view=rev
Log:
[MNG-5000] [regression] child distributionManagment.site.url not correct in a flat directory layout when child's artifactId doesn't match its module name
Modified:
maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java
Modified: maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java?rev=1072613&r1=1072612&r2=1072613&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java (original)
+++ maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java Sun Feb 20 15:34:42 2011
@@ -19,6 +19,7 @@ package org.apache.maven.model.inheritan
* under the License.
*/
+import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
@@ -74,7 +75,19 @@ public class DefaultInheritanceAssembler
if ( parent != null )
{
- String childArtifactId = child.getArtifactId();
+ String childName = child.getArtifactId();
+
+ /*
+ * This logic exists only for the sake of backward-compat with 2.x (MNG-5000). In generally, it is wrong to
+ * base URL inheritance on the project directory names as this information is unavailable for POMs in the
+ * repository. In other words, projects where artifactId != projectDirName will see different effective URLs
+ * depending on how the POM was constructed.
+ */
+ File childDirectory = child.getProjectDirectory();
+ if ( childDirectory != null )
+ {
+ childName = childDirectory.getName();
+ }
for ( String module : parent.getModules() )
{
@@ -95,7 +108,7 @@ public class DefaultInheritanceAssembler
moduleName = moduleName.substring( lastSlash + 1 );
- if ( moduleName.equals( childArtifactId ) && lastSlash >= 0 )
+ if ( moduleName.equals( childName ) && lastSlash >= 0 )
{
adjustment = module.substring( 0, lastSlash );
break;