mirror of https://github.com/apache/maven.git
remove extension from artifact - it is the sole reponsibility of the artifact handler. This prevents the error of plugins getting the extension "maven-plugin"
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163647 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fb515206b5
commit
297f542553
|
@ -42,8 +42,6 @@ public interface Artifact
|
|||
// only providing this since classifier is *very* optional...
|
||||
boolean hasClassifier();
|
||||
|
||||
String getExtension();
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
void setPath( String path );
|
||||
|
|
|
@ -44,26 +44,17 @@ public class DefaultArtifact
|
|||
|
||||
private final String scope;
|
||||
|
||||
private final String extension;
|
||||
|
||||
private String path;
|
||||
|
||||
/**
|
||||
* @todo this should be replaced by type handler
|
||||
*/
|
||||
public DefaultArtifact( String groupId, String artifactId, String version, String scope, String type,
|
||||
String extension )
|
||||
{
|
||||
this( groupId, artifactId, version, scope, type, null, extension );
|
||||
}
|
||||
|
||||
/**
|
||||
* !!! WARNING !!! Never put <classifier/> in the POM. It is for mojo use
|
||||
* only. Classifier is for specifying derived artifacts, like ejb-client.
|
||||
*/
|
||||
public DefaultArtifact( String groupId, String artifactId, String version, String scope, String type,
|
||||
String classifier, String extension )
|
||||
String classifier )
|
||||
{
|
||||
// These should help us catch coding errors until this code gets a whole lot clearer
|
||||
if ( type == null )
|
||||
{
|
||||
throw new NullPointerException( "Artifact type cannot be null." );
|
||||
|
@ -80,20 +71,16 @@ public class DefaultArtifact
|
|||
this.scope = scope;
|
||||
|
||||
this.classifier = classifier;
|
||||
}
|
||||
|
||||
if ( extension == null )
|
||||
{
|
||||
this.extension = type;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.extension = extension;
|
||||
}
|
||||
public DefaultArtifact( String groupId, String artifactId, String version, String scope, String type )
|
||||
{
|
||||
this( groupId, artifactId, version, scope, type, null );
|
||||
}
|
||||
|
||||
public DefaultArtifact( String groupId, String artifactId, String version, String type )
|
||||
{
|
||||
this( groupId, artifactId, version, null, type, null, type );
|
||||
this( groupId, artifactId, version, null, type, null );
|
||||
}
|
||||
|
||||
public String getClassifier()
|
||||
|
@ -131,11 +118,6 @@ public class DefaultArtifact
|
|||
return type;
|
||||
}
|
||||
|
||||
public String getExtension()
|
||||
{
|
||||
return extension;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
|
|
@ -25,19 +25,14 @@ import org.apache.maven.artifact.DefaultArtifact;
|
|||
*/
|
||||
public class ArtifactConstructionSupport
|
||||
{
|
||||
|
||||
|
||||
public Artifact createArtifact( String groupId, String artifactId, String version, String scope, String type )
|
||||
{
|
||||
return createArtifact( groupId, artifactId, version, scope, type, type, null );
|
||||
return createArtifact( groupId, artifactId, version, scope, type, null );
|
||||
}
|
||||
|
||||
public Artifact createArtifact( String groupId, String artifactId, String version, String scope, String type, String extension )
|
||||
{
|
||||
return createArtifact( groupId, artifactId, version, scope, type, extension, null );
|
||||
}
|
||||
|
||||
|
||||
public Artifact createArtifact( String groupId, String artifactId, String version, String scope, String type,
|
||||
String extension, String inheritedScope )
|
||||
String inheritedScope )
|
||||
{
|
||||
// TODO: can refactor, use scope handler
|
||||
|
||||
|
@ -65,7 +60,7 @@ public class ArtifactConstructionSupport
|
|||
{
|
||||
desiredScope = Artifact.SCOPE_TEST;
|
||||
}
|
||||
|
||||
return new DefaultArtifact( groupId, artifactId, version, desiredScope, type, extension );
|
||||
|
||||
return new DefaultArtifact( groupId, artifactId, version, desiredScope, type );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,8 @@ public abstract class AbstractArtifactRepositoryLayout
|
|||
|
||||
protected abstract String groupIdAsPath( String groupId );
|
||||
|
||||
public String pathOf( Artifact artifact ) throws ArtifactPathFormatException
|
||||
public String pathOf( Artifact artifact )
|
||||
throws ArtifactPathFormatException
|
||||
{
|
||||
String path = layoutPattern();
|
||||
|
||||
|
@ -64,13 +65,13 @@ public abstract class AbstractArtifactRepositoryLayout
|
|||
}
|
||||
catch ( ArtifactHandlerNotFoundException e )
|
||||
{
|
||||
throw new ArtifactPathFormatException( "Cannot find ArtifactHandler for artifact: \'" + artifact.getId()
|
||||
+ "\'.", e );
|
||||
throw new ArtifactPathFormatException( "Cannot find ArtifactHandler for artifact: \'" + artifact.getId() +
|
||||
"\'.", e );
|
||||
}
|
||||
|
||||
path = StringUtils.replace( path, "${directory}", artifactHandler.directory() );
|
||||
|
||||
path = StringUtils.replace( path, "${extension}", artifact.getExtension() );
|
||||
path = StringUtils.replace( path, "${extension}", artifactHandler.extension() );
|
||||
|
||||
return path;
|
||||
}
|
||||
|
|
|
@ -65,8 +65,8 @@ public class DefaultArtifactResolver
|
|||
try
|
||||
{
|
||||
Logger logger = getLogger();
|
||||
logger.debug( "Resolving: " + artifact.getId() + " from:\n" + "{localRepository: " + localRepository
|
||||
+ "}\n" + "{remoteRepositories: " + remoteRepositories + "}" );
|
||||
logger.debug( "Resolving: " + artifact.getId() + " from:\n" + "{localRepository: " + localRepository +
|
||||
"}\n" + "{remoteRepositories: " + remoteRepositories + "}" );
|
||||
|
||||
setLocalRepositoryPath( artifact, localRepository );
|
||||
|
||||
|
@ -95,9 +95,8 @@ public class DefaultArtifactResolver
|
|||
{
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
||||
sb.append( "The artifact is not present locally as:" ).append( LS ).append( LS ).append( artifact.getPath() )
|
||||
.append( LS ).append( LS ).append( "or in any of the specified remote repositories:" ).append( LS )
|
||||
.append( LS );
|
||||
sb.append( "The artifact is not present locally as:" ).append( LS ).append( LS ).append( artifact.getPath() ).append(
|
||||
LS ).append( LS ).append( "or in any of the specified remote repositories:" ).append( LS ).append( LS );
|
||||
|
||||
for ( Iterator i = remoteRepositories.iterator(); i.hasNext(); )
|
||||
{
|
||||
|
@ -135,8 +134,8 @@ public class DefaultArtifactResolver
|
|||
// ----------------------------------------------------------------------
|
||||
|
||||
public ArtifactResolutionResult resolveTransitively( Set artifacts, List remoteRepositories,
|
||||
ArtifactRepository localRepository,
|
||||
ArtifactMetadataSource source, ArtifactFilter filter )
|
||||
ArtifactRepository localRepository,
|
||||
ArtifactMetadataSource source, ArtifactFilter filter )
|
||||
throws ArtifactResolutionException
|
||||
{
|
||||
ArtifactResolutionResult artifactResolutionResult;
|
||||
|
@ -159,16 +158,16 @@ public class DefaultArtifactResolver
|
|||
}
|
||||
|
||||
public ArtifactResolutionResult resolveTransitively( Set artifacts, List remoteRepositories,
|
||||
ArtifactRepository localRepository,
|
||||
ArtifactMetadataSource source )
|
||||
ArtifactRepository localRepository,
|
||||
ArtifactMetadataSource source )
|
||||
throws ArtifactResolutionException
|
||||
{
|
||||
return resolveTransitively( artifacts, remoteRepositories, localRepository, source, null );
|
||||
}
|
||||
|
||||
public ArtifactResolutionResult resolveTransitively( Artifact artifact, List remoteRepositories,
|
||||
ArtifactRepository localRepository,
|
||||
ArtifactMetadataSource source )
|
||||
ArtifactRepository localRepository,
|
||||
ArtifactMetadataSource source )
|
||||
throws ArtifactResolutionException
|
||||
{
|
||||
return resolveTransitively( Collections.singleton( artifact ), remoteRepositories, localRepository, source );
|
||||
|
@ -179,8 +178,9 @@ public class DefaultArtifactResolver
|
|||
// ----------------------------------------------------------------------
|
||||
|
||||
private ArtifactResolutionResult collect( Set artifacts, ArtifactRepository localRepository,
|
||||
List remoteRepositories, ArtifactMetadataSource source,
|
||||
ArtifactFilter filter ) throws TransitiveArtifactResolutionException
|
||||
List remoteRepositories, ArtifactMetadataSource source,
|
||||
ArtifactFilter filter )
|
||||
throws TransitiveArtifactResolutionException
|
||||
{
|
||||
ArtifactResolutionResult result = new ArtifactResolutionResult();
|
||||
|
||||
|
@ -215,14 +215,14 @@ public class DefaultArtifactResolver
|
|||
|
||||
// TODO: scope handler
|
||||
boolean updateScope = false;
|
||||
if ( Artifact.SCOPE_RUNTIME.equals( newArtifact.getScope() )
|
||||
&& Artifact.SCOPE_TEST.equals( knownArtifact.getScope() ) )
|
||||
if ( Artifact.SCOPE_RUNTIME.equals( newArtifact.getScope() ) &&
|
||||
Artifact.SCOPE_TEST.equals( knownArtifact.getScope() ) )
|
||||
{
|
||||
updateScope = true;
|
||||
}
|
||||
|
||||
if ( Artifact.SCOPE_COMPILE.equals( newArtifact.getScope() )
|
||||
&& !Artifact.SCOPE_COMPILE.equals( knownArtifact.getScope() ) )
|
||||
if ( Artifact.SCOPE_COMPILE.equals( newArtifact.getScope() ) &&
|
||||
!Artifact.SCOPE_COMPILE.equals( knownArtifact.getScope() ) )
|
||||
{
|
||||
updateScope = true;
|
||||
}
|
||||
|
@ -235,8 +235,7 @@ public class DefaultArtifactResolver
|
|||
knownArtifact.getArtifactId(),
|
||||
knownVersion,
|
||||
newArtifact.getScope(),
|
||||
knownArtifact.getType(),
|
||||
knownArtifact.getExtension() );
|
||||
knownArtifact.getType() );
|
||||
resolvedArtifacts.put( artifact.getConflictId(), artifact );
|
||||
}
|
||||
}
|
||||
|
@ -261,8 +260,8 @@ public class DefaultArtifactResolver
|
|||
}
|
||||
catch ( ArtifactMetadataRetrievalException e )
|
||||
{
|
||||
throw new TransitiveArtifactResolutionException( "Error retrieving metadata [" + newArtifact
|
||||
+ "] : ", e );
|
||||
throw new TransitiveArtifactResolutionException( "Error retrieving metadata [" + newArtifact +
|
||||
"] : ", e );
|
||||
}
|
||||
|
||||
// the pom for given dependency exisit we will add it to the
|
||||
|
|
|
@ -38,7 +38,8 @@ public abstract class ArtifactComponentTestCase
|
|||
{
|
||||
protected ArtifactHandlerManager artifactHandlerManager;
|
||||
|
||||
protected void setUp() throws Exception
|
||||
protected void setUp()
|
||||
throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
|
||||
|
@ -47,9 +48,13 @@ public abstract class ArtifactComponentTestCase
|
|||
|
||||
protected abstract String component();
|
||||
|
||||
/** Return an existing file, not a directory - causes creation to fail.
|
||||
* @throws Exception*/
|
||||
protected ArtifactRepository badLocalRepository() throws Exception
|
||||
/**
|
||||
* Return an existing file, not a directory - causes creation to fail.
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected ArtifactRepository badLocalRepository()
|
||||
throws Exception
|
||||
{
|
||||
String path = "target/test-classes/repositories/" + component() + "/bad-local-repository";
|
||||
|
||||
|
@ -65,7 +70,8 @@ public abstract class ArtifactComponentTestCase
|
|||
return localRepository;
|
||||
}
|
||||
|
||||
protected ArtifactRepository localRepository() throws Exception
|
||||
protected ArtifactRepository localRepository()
|
||||
throws Exception
|
||||
{
|
||||
String path = "target/test-classes/repositories/" + component() + "/local-repository";
|
||||
|
||||
|
@ -79,7 +85,8 @@ public abstract class ArtifactComponentTestCase
|
|||
return localRepository;
|
||||
}
|
||||
|
||||
protected ArtifactRepository remoteRepository() throws Exception
|
||||
protected ArtifactRepository remoteRepository()
|
||||
throws Exception
|
||||
{
|
||||
String path = "target/test-classes/repositories/" + component() + "/remote-repository";
|
||||
|
||||
|
@ -93,7 +100,8 @@ public abstract class ArtifactComponentTestCase
|
|||
return repository;
|
||||
}
|
||||
|
||||
protected ArtifactRepository badRemoteRepository() throws Exception
|
||||
protected ArtifactRepository badRemoteRepository()
|
||||
throws Exception
|
||||
{
|
||||
ArtifactRepositoryLayout repoLayout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE,
|
||||
"legacy" );
|
||||
|
@ -103,7 +111,8 @@ public abstract class ArtifactComponentTestCase
|
|||
return repository;
|
||||
}
|
||||
|
||||
protected void assertRemoteArtifactPresent( Artifact artifact ) throws Exception
|
||||
protected void assertRemoteArtifactPresent( Artifact artifact )
|
||||
throws Exception
|
||||
{
|
||||
ArtifactRepository remoteRepo = remoteRepository();
|
||||
|
||||
|
@ -117,7 +126,8 @@ public abstract class ArtifactComponentTestCase
|
|||
}
|
||||
}
|
||||
|
||||
protected void assertLocalArtifactPresent( Artifact artifact ) throws Exception
|
||||
protected void assertLocalArtifactPresent( Artifact artifact )
|
||||
throws Exception
|
||||
{
|
||||
ArtifactRepository localRepo = localRepository();
|
||||
|
||||
|
@ -131,7 +141,8 @@ public abstract class ArtifactComponentTestCase
|
|||
}
|
||||
}
|
||||
|
||||
protected void assertRemoteArtifactNotPresent( Artifact artifact ) throws Exception
|
||||
protected void assertRemoteArtifactNotPresent( Artifact artifact )
|
||||
throws Exception
|
||||
{
|
||||
ArtifactRepository remoteRepo = remoteRepository();
|
||||
|
||||
|
@ -145,7 +156,8 @@ public abstract class ArtifactComponentTestCase
|
|||
}
|
||||
}
|
||||
|
||||
protected void assertLocalArtifactNotPresent( Artifact artifact ) throws Exception
|
||||
protected void assertLocalArtifactNotPresent( Artifact artifact )
|
||||
throws Exception
|
||||
{
|
||||
ArtifactRepository localRepo = localRepository();
|
||||
|
||||
|
@ -163,7 +175,8 @@ public abstract class ArtifactComponentTestCase
|
|||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
protected List remoteRepositories() throws Exception
|
||||
protected List remoteRepositories()
|
||||
throws Exception
|
||||
{
|
||||
List remoteRepositories = new ArrayList();
|
||||
|
||||
|
@ -176,7 +189,8 @@ public abstract class ArtifactComponentTestCase
|
|||
// Test artifact generation for unit tests
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
protected Artifact createLocalArtifact( String artifactId, String version ) throws Exception
|
||||
protected Artifact createLocalArtifact( String artifactId, String version )
|
||||
throws Exception
|
||||
{
|
||||
Artifact artifact = createArtifact( artifactId, version );
|
||||
|
||||
|
@ -185,7 +199,8 @@ public abstract class ArtifactComponentTestCase
|
|||
return artifact;
|
||||
}
|
||||
|
||||
protected Artifact createRemoteArtifact( String artifactId, String version ) throws Exception
|
||||
protected Artifact createRemoteArtifact( String artifactId, String version )
|
||||
throws Exception
|
||||
{
|
||||
Artifact artifact = createArtifact( artifactId, version );
|
||||
|
||||
|
@ -194,17 +209,20 @@ public abstract class ArtifactComponentTestCase
|
|||
return artifact;
|
||||
}
|
||||
|
||||
protected void createLocalArtifact( Artifact artifact ) throws Exception
|
||||
protected void createLocalArtifact( Artifact artifact )
|
||||
throws Exception
|
||||
{
|
||||
createArtifact( artifact, localRepository() );
|
||||
}
|
||||
|
||||
protected void createRemoteArtifact( Artifact artifact ) throws Exception
|
||||
protected void createRemoteArtifact( Artifact artifact )
|
||||
throws Exception
|
||||
{
|
||||
createArtifact( artifact, remoteRepository() );
|
||||
}
|
||||
|
||||
protected void createArtifact( Artifact artifact, ArtifactRepository repository ) throws Exception
|
||||
protected void createArtifact( Artifact artifact, ArtifactRepository repository )
|
||||
throws Exception
|
||||
{
|
||||
String path = repository.pathOf( artifact );
|
||||
|
||||
|
@ -234,15 +252,17 @@ public abstract class ArtifactComponentTestCase
|
|||
|
||||
protected Artifact createArtifact( String groupId, String artifactId, String version, String type )
|
||||
{
|
||||
return new DefaultArtifact( groupId, artifactId, version, Artifact.SCOPE_COMPILE, type, type );
|
||||
return new DefaultArtifact( groupId, artifactId, version, Artifact.SCOPE_COMPILE, type );
|
||||
}
|
||||
|
||||
protected void deleteLocalArtifact( Artifact artifact ) throws Exception
|
||||
protected void deleteLocalArtifact( Artifact artifact )
|
||||
throws Exception
|
||||
{
|
||||
deleteArtifact( artifact, localRepository() );
|
||||
}
|
||||
|
||||
protected void deleteArtifact( Artifact artifact, ArtifactRepository repository ) throws Exception
|
||||
protected void deleteArtifact( Artifact artifact, ArtifactRepository repository )
|
||||
throws Exception
|
||||
{
|
||||
String path = repository.pathOf( artifact );
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ public class MavenMetadataSource
|
|||
Artifact metadataArtifact = artifactFactory.createArtifact( artifact.getGroupId(),
|
||||
artifact.getArtifactId(),
|
||||
artifact.getVersion(), artifact.getScope(),
|
||||
"pom", "pom", null );
|
||||
"pom", null );
|
||||
|
||||
artifactResolver.resolve( metadataArtifact, remoteRepositories, localRepository );
|
||||
|
||||
|
|
|
@ -34,5 +34,5 @@ public interface ArtifactFactory
|
|||
Artifact createArtifact( Dependency dependency, ArtifactRepository localRepository, String inheritedScope );
|
||||
|
||||
Artifact createArtifact( String groupId, String artifactId, String version, String scope, String type,
|
||||
String extension, String inheritedScope );
|
||||
String inheritedScope );
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ public class DefaultArtifactFactory
|
|||
public Artifact createArtifact( Dependency dependency, ArtifactRepository localRepository, String inheritedScope )
|
||||
{
|
||||
return createArtifact( dependency.getGroupId(), dependency.getArtifactId(), dependency.getVersion(),
|
||||
dependency.getScope(), dependency.getType(), dependency.getType(), inheritedScope );
|
||||
dependency.getScope(), dependency.getType(), inheritedScope );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -109,7 +109,8 @@ public class DefaultMavenProjectBuilder
|
|||
return build( project, localRepository, true, true );
|
||||
}
|
||||
|
||||
public MavenProject build( File project, ArtifactRepository localRepository ) throws ProjectBuildingException
|
||||
public MavenProject build( File project, ArtifactRepository localRepository )
|
||||
throws ProjectBuildingException
|
||||
{
|
||||
return build( project, localRepository, false, true );
|
||||
}
|
||||
|
@ -121,7 +122,8 @@ public class DefaultMavenProjectBuilder
|
|||
}
|
||||
|
||||
private MavenProject build( File projectDescriptor, ArtifactRepository localRepository,
|
||||
boolean resolveDependencies, boolean sourceProject ) throws ProjectBuildingException
|
||||
boolean resolveDependencies, boolean sourceProject )
|
||||
throws ProjectBuildingException
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -156,7 +158,8 @@ public class DefaultMavenProjectBuilder
|
|||
}
|
||||
|
||||
private MavenProject processProjectLogic( MavenProject project, ArtifactRepository localRepository,
|
||||
List remoteRepositories, boolean resolveDependencies, boolean sourceProject )
|
||||
List remoteRepositories, boolean resolveDependencies,
|
||||
boolean sourceProject )
|
||||
throws ProjectBuildingException, ModelInterpolationException, ArtifactResolutionException
|
||||
{
|
||||
Model model = project.getModel();
|
||||
|
@ -196,9 +199,9 @@ public class DefaultMavenProjectBuilder
|
|||
{
|
||||
try
|
||||
{
|
||||
project
|
||||
.setDistributionManagementArtifactRepository( buildDistributionManagementRepository( dm
|
||||
.getRepository() ) );
|
||||
project.setDistributionManagementArtifactRepository(
|
||||
buildDistributionManagementRepository(
|
||||
dm.getRepository() ) );
|
||||
}
|
||||
catch ( Exception e )
|
||||
{
|
||||
|
@ -249,7 +252,7 @@ public class DefaultMavenProjectBuilder
|
|||
}
|
||||
|
||||
private MavenProject assembleLineage( File projectDescriptor, ArtifactRepository localRepository,
|
||||
LinkedList lineage, List aggregatedRemoteWagonRepositories )
|
||||
LinkedList lineage, List aggregatedRemoteWagonRepositories )
|
||||
throws ProjectBuildingException
|
||||
{
|
||||
Model model = readModel( projectDescriptor );
|
||||
|
@ -261,7 +264,8 @@ public class DefaultMavenProjectBuilder
|
|||
}
|
||||
|
||||
private MavenProject assembleLineage( Model model, ArtifactRepository localRepository, LinkedList lineage,
|
||||
List aggregatedRemoteWagonRepositories ) throws ProjectBuildingException
|
||||
List aggregatedRemoteWagonRepositories )
|
||||
throws ProjectBuildingException
|
||||
{
|
||||
MavenProject project = new MavenProject( model );
|
||||
|
||||
|
@ -293,8 +297,8 @@ public class DefaultMavenProjectBuilder
|
|||
// as we go in order to do this.
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
aggregatedRemoteWagonRepositories
|
||||
.addAll( buildArtifactRepositories( project.getModel().getRepositories() ) );
|
||||
aggregatedRemoteWagonRepositories.addAll(
|
||||
buildArtifactRepositories( project.getModel().getRepositories() ) );
|
||||
|
||||
MavenProject parent;
|
||||
Model cachedModel = getCachedModel( parentModel.getGroupId(), parentModel.getArtifactId(),
|
||||
|
@ -315,7 +319,8 @@ public class DefaultMavenProjectBuilder
|
|||
return project;
|
||||
}
|
||||
|
||||
private List buildArtifactRepositories( List repositories ) throws ProjectBuildingException
|
||||
private List buildArtifactRepositories( List repositories )
|
||||
throws ProjectBuildingException
|
||||
{
|
||||
MavenSettings settings = null;
|
||||
|
||||
|
@ -341,7 +346,8 @@ public class DefaultMavenProjectBuilder
|
|||
}
|
||||
catch ( ComponentLookupException e )
|
||||
{
|
||||
throw new ProjectBuildingException( "Cannot find repository layout for: \'" + remoteRepoLayoutId + "\'.", e );
|
||||
throw new ProjectBuildingException( "Cannot find repository layout for: \'" + remoteRepoLayoutId + "\'.",
|
||||
e );
|
||||
}
|
||||
for ( Iterator i = repositories.iterator(); i.hasNext(); )
|
||||
{
|
||||
|
@ -358,7 +364,8 @@ public class DefaultMavenProjectBuilder
|
|||
return repos;
|
||||
}
|
||||
|
||||
private List buildPluginRepositories( List pluginRepositories ) throws Exception
|
||||
private List buildPluginRepositories( List pluginRepositories )
|
||||
throws Exception
|
||||
{
|
||||
List remotePluginRepositories = new ArrayList();
|
||||
|
||||
|
@ -373,10 +380,8 @@ public class DefaultMavenProjectBuilder
|
|||
// TODO: [jc] change this to detect the repository layout type somehow...
|
||||
String repoLayoutId = "legacy";
|
||||
|
||||
ArtifactRepositoryLayout repositoryLayout = (ArtifactRepositoryLayout) container
|
||||
.lookup(
|
||||
ArtifactRepositoryLayout.ROLE,
|
||||
repoLayoutId );
|
||||
ArtifactRepositoryLayout repositoryLayout = (ArtifactRepositoryLayout) container.lookup(
|
||||
ArtifactRepositoryLayout.ROLE, repoLayoutId );
|
||||
|
||||
ArtifactRepository pluginRepository = artifactRepositoryFactory.createArtifactRepository( pluginRepo, settings,
|
||||
repositoryLayout );
|
||||
|
@ -386,7 +391,8 @@ public class DefaultMavenProjectBuilder
|
|||
return remotePluginRepositories;
|
||||
}
|
||||
|
||||
private ArtifactRepository buildDistributionManagementRepository( Repository dmRepo ) throws Exception
|
||||
private ArtifactRepository buildDistributionManagementRepository( Repository dmRepo )
|
||||
throws Exception
|
||||
{
|
||||
// TODO: needs to be configured from the POM element
|
||||
|
||||
|
@ -395,10 +401,8 @@ public class DefaultMavenProjectBuilder
|
|||
// TODO: [jc] change this to detect the repository layout type somehow...
|
||||
String repoLayoutId = "legacy";
|
||||
|
||||
ArtifactRepositoryLayout repositoryLayout = (ArtifactRepositoryLayout) container
|
||||
.lookup(
|
||||
ArtifactRepositoryLayout.ROLE,
|
||||
repoLayoutId );
|
||||
ArtifactRepositoryLayout repositoryLayout = (ArtifactRepositoryLayout) container.lookup(
|
||||
ArtifactRepositoryLayout.ROLE, repoLayoutId );
|
||||
|
||||
ArtifactRepository dmArtifactRepository = artifactRepositoryFactory.createArtifactRepository( dmRepo, settings,
|
||||
repositoryLayout );
|
||||
|
@ -406,7 +410,8 @@ public class DefaultMavenProjectBuilder
|
|||
return dmArtifactRepository;
|
||||
}
|
||||
|
||||
private Model readModel( File file ) throws ProjectBuildingException
|
||||
private Model readModel( File file )
|
||||
throws ProjectBuildingException
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -419,12 +424,12 @@ public class DefaultMavenProjectBuilder
|
|||
catch ( Exception e )
|
||||
{
|
||||
throw new ProjectBuildingException(
|
||||
"Error while reading model from file '" + file.getAbsolutePath() + "'.",
|
||||
e );
|
||||
"Error while reading model from file '" + file.getAbsolutePath() + "'.", e );
|
||||
}
|
||||
}
|
||||
|
||||
private Model readModel( URL url ) throws ProjectBuildingException
|
||||
private Model readModel( URL url )
|
||||
throws ProjectBuildingException
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -444,7 +449,7 @@ public class DefaultMavenProjectBuilder
|
|||
throws ProjectBuildingException
|
||||
{
|
||||
Artifact artifact = artifactFactory.createArtifact( parent.getGroupId(), parent.getArtifactId(),
|
||||
parent.getVersion(), null, "pom", "pom", null );
|
||||
parent.getVersion(), null, "pom", null );
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -453,8 +458,8 @@ public class DefaultMavenProjectBuilder
|
|||
catch ( ArtifactResolutionException e )
|
||||
{
|
||||
// @todo use parent.toString() if modello could generate it, or specify in a code segment
|
||||
throw new ProjectBuildingException( "Missing parent POM: " + parent.getGroupId() + ":"
|
||||
+ parent.getArtifactId() + "-" + parent.getVersion(), e );
|
||||
throw new ProjectBuildingException( "Missing parent POM: " + parent.getGroupId() + ":" +
|
||||
parent.getArtifactId() + "-" + parent.getVersion(), e );
|
||||
}
|
||||
|
||||
return artifact.getFile();
|
||||
|
@ -507,14 +512,16 @@ public class DefaultMavenProjectBuilder
|
|||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
private Model getSuperModel() throws ProjectBuildingException
|
||||
private Model getSuperModel()
|
||||
throws ProjectBuildingException
|
||||
{
|
||||
URL url = DefaultMavenProjectBuilder.class.getResource( "pom-" + MavenConstants.MAVEN_MODEL_VERSION + ".xml" );
|
||||
|
||||
return readModel( url );
|
||||
}
|
||||
|
||||
public void contextualize( Context context ) throws Exception
|
||||
public void contextualize( Context context )
|
||||
throws Exception
|
||||
{
|
||||
this.container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
|
||||
}
|
||||
|
|
|
@ -254,8 +254,8 @@ public class MavenProject
|
|||
if ( isAddedToClasspath( a ) )
|
||||
{
|
||||
// TODO: let the scope handler deal with this
|
||||
if ( Artifact.SCOPE_TEST.equals( a.getScope() ) || Artifact.SCOPE_COMPILE.equals( a.getScope() )
|
||||
|| Artifact.SCOPE_RUNTIME.equals( a.getScope() ) )
|
||||
if ( Artifact.SCOPE_TEST.equals( a.getScope() ) || Artifact.SCOPE_COMPILE.equals( a.getScope() ) ||
|
||||
Artifact.SCOPE_RUNTIME.equals( a.getScope() ) )
|
||||
{
|
||||
list.add( a.getPath() );
|
||||
}
|
||||
|
@ -609,7 +609,8 @@ public class MavenProject
|
|||
* <li>do a topo sort on the graph that remains.</li>
|
||||
* </ul>
|
||||
*/
|
||||
public static List getSortedProjects( List projects ) throws CycleDetectedException
|
||||
public static List getSortedProjects( List projects )
|
||||
throws CycleDetectedException
|
||||
{
|
||||
DAG dag = new DAG();
|
||||
|
||||
|
@ -685,13 +686,14 @@ public class MavenProject
|
|||
{
|
||||
Artifact existing = (Artifact) artifacts.get( id );
|
||||
boolean updateScope = false;
|
||||
if ( Artifact.SCOPE_RUNTIME.equals( a.getScope() ) && Artifact.SCOPE_TEST.equals( existing.getScope() ) )
|
||||
if ( Artifact.SCOPE_RUNTIME.equals( a.getScope() ) &&
|
||||
Artifact.SCOPE_TEST.equals( existing.getScope() ) )
|
||||
{
|
||||
updateScope = true;
|
||||
}
|
||||
|
||||
if ( Artifact.SCOPE_COMPILE.equals( a.getScope() )
|
||||
&& !Artifact.SCOPE_COMPILE.equals( existing.getScope() ) )
|
||||
if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) &&
|
||||
!Artifact.SCOPE_COMPILE.equals( existing.getScope() ) )
|
||||
{
|
||||
updateScope = true;
|
||||
}
|
||||
|
@ -703,8 +705,7 @@ public class MavenProject
|
|||
Artifact artifact = artifactConstructionSupport.createArtifact( existing.getGroupId(),
|
||||
existing.getArtifactId(),
|
||||
existing.getVersion(),
|
||||
a.getScope(), existing.getType(),
|
||||
existing.getExtension() );
|
||||
a.getScope(), existing.getType() );
|
||||
|
||||
artifacts.put( id, artifact );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue