mirror of https://github.com/apache/maven.git
o resolving dependencies of a root artifact is now the job of ... the artifact resolver!
git-svn-id: https://svn.apache.org/repos/asf/maven/components/branches/MNG-2766@769969 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
abec748f23
commit
d993c66b23
|
@ -45,6 +45,8 @@ public class ArtifactResolutionRequest
|
|||
private TransferListener transferListener;
|
||||
|
||||
private boolean resolveRoot = true;
|
||||
|
||||
private boolean resolveDependencies = false;
|
||||
|
||||
public ArtifactResolutionRequest()
|
||||
{
|
||||
|
@ -175,6 +177,18 @@ public class ArtifactResolutionRequest
|
|||
{
|
||||
return resolveRoot;
|
||||
}
|
||||
|
||||
public ArtifactResolutionRequest setResolveDependencies( boolean resolveDependencies )
|
||||
{
|
||||
this.resolveDependencies = resolveDependencies;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isResolveDependencies()
|
||||
{
|
||||
return resolveDependencies;
|
||||
}
|
||||
|
||||
public TransferListener getTransferListener()
|
||||
{
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.apache.maven.artifact.Artifact;
|
|||
import org.apache.maven.artifact.factory.ArtifactFactory;
|
||||
import org.apache.maven.artifact.manager.WagonManager;
|
||||
import org.apache.maven.artifact.metadata.ArtifactMetadata;
|
||||
import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
|
||||
import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.metadata.Metadata;
|
||||
|
@ -420,6 +421,20 @@ public class DefaultArtifactResolver
|
|||
}
|
||||
}
|
||||
|
||||
if ( request.isResolveDependencies() )
|
||||
{
|
||||
try
|
||||
{
|
||||
artifacts = source.retrieve( rootArtifact, localRepository, remoteRepositories ).getArtifacts();
|
||||
}
|
||||
catch ( ArtifactMetadataRetrievalException e )
|
||||
{
|
||||
e.printStackTrace();
|
||||
// need to add metadata resolution exception
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
if ( artifacts == null || artifacts.size() == 0 )
|
||||
{
|
||||
result.addArtifact( rootArtifact );
|
||||
|
|
|
@ -214,7 +214,7 @@ public class DefaultPluginManager
|
|||
// Not going to happen
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
logger.debug( "Discovering components in realm: " + pluginRealm );
|
||||
|
@ -312,8 +312,9 @@ public class DefaultPluginManager
|
|||
.setRemoteRepostories( new ArrayList( project.getRemoteArtifactRepositories() ) )
|
||||
.setManagedVersionMap( pluginManagedDependencies )
|
||||
.setFilter( filter )
|
||||
.setResolveDependencies( true )
|
||||
.setResolveRoot( true ); // We are setting this to false because the artifact itself has been resolved.
|
||||
|
||||
|
||||
ArtifactResolutionResult result = repositorySystem.resolve( request );
|
||||
resolutionErrorHandler.throwErrors( request, result );
|
||||
|
||||
|
|
|
@ -91,13 +91,6 @@ public class DefaultMavenProjectBuilder
|
|||
@Requirement
|
||||
private ResolutionErrorHandler resolutionErrorHandler;
|
||||
|
||||
//DO NOT USE, it is here only for backward compatibility reasons. The existing
|
||||
// maven-assembly-plugin (2.2-beta-1) is accessing it via reflection.
|
||||
|
||||
// the aspect weaving seems not to work for reflection from plugin.
|
||||
|
||||
private Map processedProjectCache = new HashMap();
|
||||
|
||||
private static HashMap<String, MavenProject> hm = new HashMap<String, MavenProject>();
|
||||
|
||||
private MavenProject superProject;
|
||||
|
|
Loading…
Reference in New Issue