o remove another set of methods from the repository system interface and now ResolutionGroup is gone from Maven internals.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@751083 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2009-03-06 21:37:07 +00:00
parent 46dc31c0fe
commit c67176f502
3 changed files with 24 additions and 50 deletions

View File

@ -56,6 +56,7 @@
import org.apache.maven.execution.RuntimeInformation;
import org.apache.maven.lifecycle.model.MojoBinding;
import org.apache.maven.lifecycle.statemgmt.StateManagementUtils;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.Model;
import org.apache.maven.model.Plugin;
import org.apache.maven.model.ReportPlugin;
@ -366,24 +367,27 @@ private Set<Artifact> getPluginArtifacts( Artifact pluginArtifact, Plugin plugin
InvalidDependencyVersionException ee = new InvalidDependencyVersionException( e.getProjectId(), e.getDependency(), e.getPomFile(), e.getCauseException() );
throw new InvalidPluginException( "Plugin '" + plugin + "' is invalid: " + e.getMessage(), ee );
}
ResolutionGroup resolutionGroup;
try
{
resolutionGroup = repositorySystem.retrieve( pluginArtifact, localRepository, project.getRemoteArtifactRepositories() );
}
catch ( ArtifactMetadataRetrievalException e )
{
throw new ArtifactResolutionException( "Unable to download metadata from repository for plugin '" + pluginArtifact.getId() + "': " + e.getMessage(), pluginArtifact, e );
}
/* get plugin managed versions */
Map pluginManagedDependencies = new HashMap();
// This is really crappy that we have to do this. The repository system should deal with this. The retrieval of the transitive dependencies.
List<Artifact> pluginArtifacts = new ArrayList<Artifact>();
try
{
MavenProject pluginProject = mavenProjectBuilder.buildFromRepository( pluginArtifact, project.getRemoteArtifactRepositories(), localRepository );
Artifact pluginPomArtifact = repositorySystem.createProjectArtifact( pluginArtifact.getGroupId(), pluginArtifact.getArtifactId(), pluginArtifact.getVersion() );
// This does not populate the artifacts of the dependenct projects
MavenProject pluginProject = mavenProjectBuilder.buildFromRepository( pluginPomArtifact, project.getRemoteArtifactRepositories(), localRepository );
// This needs to be changed so that the resolver deals with this
for ( Dependency d : pluginProject.getDependencies() )
{
pluginArtifacts.add( repositorySystem.createArtifact( d.getGroupId(), d.getArtifactId(), d.getVersion(), d.getScope(), d.getType() ) );
}
if ( pluginProject != null )
{
pluginManagedDependencies = pluginProject.getManagedVersionMap();
@ -391,7 +395,7 @@ private Set<Artifact> getPluginArtifacts( Artifact pluginArtifact, Plugin plugin
}
catch ( ProjectBuildingException e )
{
// this can't happen, it would have blowed up at artifactMetadataSource.retrieve()
throw new InvalidPluginException( "Error resolving plugin POM " + e.getMessage() );
}
Set<Artifact> dependencies = new LinkedHashSet<Artifact>();
@ -400,7 +404,7 @@ private Set<Artifact> getPluginArtifacts( Artifact pluginArtifact, Plugin plugin
dependencies.addAll( projectPluginDependencies );
// followed by the plugin's default artifact set
dependencies.addAll( resolutionGroup.getArtifacts() );
dependencies.addAll( pluginArtifacts );
ArtifactResolutionRequest request = new ArtifactResolutionRequest()
.setArtifact( pluginArtifact )
@ -1791,24 +1795,8 @@ private String resolveMetaVersion( String groupId, String artifactId, MavenProje
Artifact artifact = repositorySystem.createProjectArtifact( groupId, artifactId, metaVersionId );
String key = artifact.getDependencyConflictId();
String version = null;
// This takes the spec version and resolves a real version
try
{
ResolutionGroup resolutionGroup = repositorySystem.retrieve( artifact, localRepository, project.getRemoteArtifactRepositories() );
// switching this out with the actual resolved artifact instance, since the MMSource re-creates the pom
// artifact.
artifact = resolutionGroup.getPomArtifact();
}
catch ( ArtifactMetadataRetrievalException e )
{
throw new PluginVersionResolutionException( groupId, artifactId, e.getMessage(), e );
}
String artifactVersion = artifact.getVersion();
// make sure this artifact was transformed to a real version, and actually resolved to a file in the repo...
@ -1819,7 +1807,9 @@ private String resolveMetaVersion( String groupId, String artifactId, MavenProje
while ( !pluginValid && ( artifactVersion != null ) )
{
pluginValid = true;
MavenProject pluginProject;
try
{
artifact = repositorySystem.createProjectArtifact( groupId, artifactId, artifactVersion );

View File

@ -461,12 +461,6 @@ public void addPermissionInfo( String repositoryId, String filePermissions, Stri
serverPermissionsMap.put( repositoryId, permissions );
}
}
public Artifact retrieveRelocatedArtifact( Artifact artifact, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories )
throws ArtifactMetadataRetrievalException
{
return artifactMetadataSource.retrieveRelocatedArtifact( artifact, localRepository, remoteRepositories );
}
// Mirror

View File

@ -61,7 +61,7 @@ public interface MavenRepositorySystem
Artifact createDependencyArtifact( String groupId, String artifactId, String version, String type, String classifier, String scope, String inheritedScope );
Set<Artifact> createArtifacts( List<Dependency> dependencies, String inheritedScope, ArtifactFilter dependencyFilter, MavenRepositoryWrapper reactor )
throws VersionNotFoundException;
throws VersionNotFoundException;
// Repository creation
@ -74,18 +74,8 @@ ArtifactRepository createLocalRepository( String url, String repositoryId )
ArtifactResolutionResult resolve( ArtifactResolutionRequest request );
// Metadata
//MetadataResolutionResult resolveMetadata( MetadataResolutionRequest request );
ResolutionGroup retrieve( Artifact artifact, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories )
throws ArtifactMetadataRetrievalException;
// Relocated artifacts are stupid. If you you want to move your shit then too bad. You have to support all your users and leave your stuff
// there. This is just so problematic because it makes Maven folk responsible and makes the system complicated.
public Artifact retrieveRelocatedArtifact( Artifact artifact, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories )
throws ArtifactMetadataRetrievalException;
// Network enablement: this needs to go as we will know at a higher level from the embedder if the system is offline or not, we should not have to
// deal with this here.
void setOnline( boolean online );