mirror of https://github.com/apache/maven.git
fix issues with cloning appending extra paths
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@279237 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
aa34ddef37
commit
434ec90fa6
|
@ -466,7 +466,7 @@ public final class ModelUtils
|
|||
newModel.setVersion( model.getVersion() );
|
||||
newModel.setArtifactId( model.getArtifactId() );
|
||||
newModel.setModules( cloneModules( model.getModules() ) );
|
||||
assembler.assembleModelInheritance( newModel, model );
|
||||
assembler.copyModel( newModel, model );
|
||||
return newModel;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,17 @@ import java.util.TreeMap;
|
|||
public class DefaultModelInheritanceAssembler
|
||||
implements ModelInheritanceAssembler
|
||||
{
|
||||
public void copyModel( Model dest, Model source )
|
||||
{
|
||||
assembleModelInheritance( dest, source, false );
|
||||
}
|
||||
|
||||
public void assembleModelInheritance( Model child, Model parent )
|
||||
{
|
||||
assembleModelInheritance( child, parent, true );
|
||||
}
|
||||
|
||||
private void assembleModelInheritance( Model child, Model parent, boolean appendPaths )
|
||||
{
|
||||
// cannot inherit from null parent.
|
||||
if ( parent == null )
|
||||
|
@ -83,7 +93,7 @@ public class DefaultModelInheritanceAssembler
|
|||
{
|
||||
if ( parent.getUrl() != null )
|
||||
{
|
||||
child.setUrl( appendPath( parent.getUrl(), child.getArtifactId() ) );
|
||||
child.setUrl( appendPath( parent.getUrl(), child.getArtifactId(), appendPaths ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -95,7 +105,7 @@ public class DefaultModelInheritanceAssembler
|
|||
// Distribution
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
assembleDistributionInheritence( child, parent );
|
||||
assembleDistributionInheritence( child, parent, appendPaths );
|
||||
|
||||
// issueManagement
|
||||
if ( child.getIssueManagement() == null )
|
||||
|
@ -116,7 +126,7 @@ public class DefaultModelInheritanceAssembler
|
|||
}
|
||||
|
||||
// Scm
|
||||
assembleScmInheritance( child, parent );
|
||||
assembleScmInheritance( child, parent, appendPaths );
|
||||
|
||||
// ciManagement
|
||||
if ( child.getCiManagement() == null )
|
||||
|
@ -382,7 +392,7 @@ public class DefaultModelInheritanceAssembler
|
|||
}
|
||||
|
||||
|
||||
private void assembleScmInheritance( Model child, Model parent )
|
||||
private void assembleScmInheritance( Model child, Model parent, boolean appendPaths )
|
||||
{
|
||||
if ( parent.getScm() != null )
|
||||
{
|
||||
|
@ -399,24 +409,25 @@ public class DefaultModelInheritanceAssembler
|
|||
|
||||
if ( StringUtils.isEmpty( childScm.getConnection() ) && !StringUtils.isEmpty( parentScm.getConnection() ) )
|
||||
{
|
||||
childScm.setConnection( appendPath( parentScm.getConnection(), child.getArtifactId() ) );
|
||||
childScm.setConnection( appendPath( parentScm.getConnection(), child.getArtifactId(), appendPaths ) );
|
||||
}
|
||||
|
||||
if ( StringUtils.isEmpty( childScm.getDeveloperConnection() ) &&
|
||||
!StringUtils.isEmpty( parentScm.getDeveloperConnection() ) )
|
||||
{
|
||||
childScm
|
||||
.setDeveloperConnection( appendPath( parentScm.getDeveloperConnection(), child.getArtifactId() ) );
|
||||
.setDeveloperConnection(
|
||||
appendPath( parentScm.getDeveloperConnection(), child.getArtifactId(), appendPaths ) );
|
||||
}
|
||||
|
||||
if ( StringUtils.isEmpty( childScm.getUrl() ) && !StringUtils.isEmpty( parentScm.getUrl() ) )
|
||||
{
|
||||
childScm.setUrl( appendPath( parentScm.getUrl(), child.getArtifactId() ) );
|
||||
childScm.setUrl( appendPath( parentScm.getUrl(), child.getArtifactId(), appendPaths ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void assembleDistributionInheritence( Model child, Model parent )
|
||||
private void assembleDistributionInheritence( Model child, Model parent, boolean appendPaths )
|
||||
{
|
||||
if ( parent.getDistributionManagement() != null )
|
||||
{
|
||||
|
@ -447,7 +458,7 @@ public class DefaultModelInheritanceAssembler
|
|||
|
||||
if ( site.getUrl() != null )
|
||||
{
|
||||
site.setUrl( appendPath( site.getUrl(), child.getArtifactId() ) );
|
||||
site.setUrl( appendPath( site.getUrl(), child.getArtifactId(), appendPaths ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -486,7 +497,9 @@ public class DefaultModelInheritanceAssembler
|
|||
}
|
||||
}
|
||||
|
||||
private String appendPath( String url, String path )
|
||||
private String appendPath( String url, String path, boolean appendPaths )
|
||||
{
|
||||
if ( appendPaths )
|
||||
{
|
||||
if ( url.endsWith( "/" ) )
|
||||
{
|
||||
|
@ -497,6 +510,11 @@ public class DefaultModelInheritanceAssembler
|
|||
return url + "/" + path;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
||||
private void mergeExtensionLists( Build childBuild, Build parentBuild )
|
||||
{
|
||||
|
|
|
@ -27,4 +27,6 @@ public interface ModelInheritanceAssembler
|
|||
String ROLE = ModelInheritanceAssembler.class.getName();
|
||||
|
||||
void assembleModelInheritance( Model child, Model parent );
|
||||
|
||||
void copyModel( Model dest, Model source );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue