mirror of https://github.com/apache/maven.git
[MNG-5000] [regression] child distributionManagment.site.url not correct in a flat directory layout when child's artifactId doesn't match its module name
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@1072613 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
88349565ec
commit
a8ce74df45
|
@ -19,6 +19,7 @@ package org.apache.maven.model.inheritance;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
|
@ -74,7 +75,19 @@ public class DefaultInheritanceAssembler
|
||||||
|
|
||||||
if ( parent != null )
|
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() )
|
for ( String module : parent.getModules() )
|
||||||
{
|
{
|
||||||
|
@ -95,7 +108,7 @@ public class DefaultInheritanceAssembler
|
||||||
|
|
||||||
moduleName = moduleName.substring( lastSlash + 1 );
|
moduleName = moduleName.substring( lastSlash + 1 );
|
||||||
|
|
||||||
if ( moduleName.equals( childArtifactId ) && lastSlash >= 0 )
|
if ( moduleName.equals( childName ) && lastSlash >= 0 )
|
||||||
{
|
{
|
||||||
adjustment = module.substring( 0, lastSlash );
|
adjustment = module.substring( 0, lastSlash );
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue