o use the remote repos processed by the request

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@750152 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2009-03-04 20:53:37 +00:00
parent b746b13a69
commit 83720e04ca
3 changed files with 14 additions and 30 deletions

View File

@ -98,7 +98,6 @@ import org.codehaus.plexus.component.repository.exception.ComponentRepositoryExc
import org.codehaus.plexus.configuration.PlexusConfiguration;
import org.codehaus.plexus.configuration.PlexusConfigurationException;
import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.xml.Xpp3Dom;
@ -170,23 +169,15 @@ public class DefaultPluginManager
//
// ----------------------------------------------------------------------
public Plugin getPluginDefinitionForPrefix( String prefix,
MavenSession session,
MavenProject project )
public Plugin getPluginDefinitionForPrefix( String prefix, MavenSession session, MavenProject project )
{
// TODO: since this is only used in the lifecycle executor, maybe it should be moved there? There is no other
// use for the mapping manager in here
return pluginMappingManager.getByPrefix( prefix, session.getPluginGroups(),
project.getRemoteArtifactRepositories(),
session.getLocalRepository() );
return pluginMappingManager.getByPrefix( prefix, session.getPluginGroups(), project.getRemoteArtifactRepositories(), session.getLocalRepository() );
}
public PluginDescriptor verifyPlugin( Plugin plugin,
MavenProject project,
MavenSession session )
throws ArtifactResolutionException, PluginVersionResolutionException,
ArtifactNotFoundException, InvalidPluginException,
PluginManagerException, PluginNotFoundException, PluginVersionNotFoundException
public PluginDescriptor verifyPlugin( Plugin plugin, MavenProject project, MavenSession session )
throws ArtifactResolutionException, PluginVersionResolutionException, ArtifactNotFoundException, InvalidPluginException, PluginManagerException, PluginNotFoundException, PluginVersionNotFoundException
{
String pluginVersion = plugin.getVersion();

View File

@ -78,11 +78,8 @@ public class DefaultPluginManagerSupport
private Context containerContext;
public Artifact resolvePluginArtifact( Plugin plugin,
MavenProject project,
MavenSession session )
throws PluginManagerException, InvalidPluginException, PluginVersionResolutionException,
ArtifactResolutionException, ArtifactNotFoundException
public Artifact resolvePluginArtifact( Plugin plugin, MavenProject project, MavenSession session )
throws PluginManagerException, InvalidPluginException, PluginVersionResolutionException, ArtifactResolutionException, ArtifactNotFoundException
{
ArtifactRepository localRepository = session.getLocalRepository();
@ -102,12 +99,9 @@ public class DefaultPluginManagerSupport
if(pluginProject == null)
{
pluginProject = buildPluginProject( plugin,
localRepository,
remoteRepositories );
pluginProject = buildPluginProject( plugin, localRepository, remoteRepositories );
}
checkRequiredMavenVersion( plugin, pluginProject, localRepository, remoteRepositories );
checkPluginDependencySpec( plugin, pluginProject );
@ -116,8 +110,7 @@ public class DefaultPluginManagerSupport
pluginArtifact = project.replaceWithActiveArtifact( pluginArtifact );
ArtifactResolutionRequest request =
new ArtifactResolutionRequest( pluginArtifact, localRepository, remoteRepositories );
ArtifactResolutionRequest request = new ArtifactResolutionRequest( pluginArtifact, localRepository, remoteRepositories );
ArtifactResolutionResult result = repositorySystem.resolve( request );
resolutionErrorHandler.throwErrors( request, result );
@ -130,9 +123,7 @@ public class DefaultPluginManagerSupport
Artifact artifact = repositorySystem.createProjectArtifact( plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion() );
try
{
return mavenProjectBuilder.buildFromRepository( artifact,
remoteRepositories,
localRepository );
return mavenProjectBuilder.buildFromRepository( artifact, remoteRepositories, localRepository );
}
catch ( ProjectBuildingException e )
{

View File

@ -208,7 +208,7 @@ public class DefaultMavenProjectBuilder
return buildFromRepository( artifact, remoteArtifactRepositories, localRepository );
}
public MavenProject buildFromRepository( Artifact artifact, List remoteArtifactRepositories, ArtifactRepository localRepository )
public MavenProject buildFromRepository( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository )
throws ProjectBuildingException
{
MavenProject project = hm.get( artifact.getId() );
@ -218,7 +218,7 @@ public class DefaultMavenProjectBuilder
return project;
}
List<ArtifactRepository> artifactRepositories = new ArrayList<ArtifactRepository>( remoteArtifactRepositories );
List<ArtifactRepository> artifactRepositories = new ArrayList<ArtifactRepository>( remoteRepositories );
try
{
artifactRepositories.addAll( repositorySystem.buildArtifactRepositories( getSuperModel().getRepositories() ) );
@ -246,7 +246,9 @@ public class DefaultMavenProjectBuilder
throw new ProjectBuildingException( artifact.getId(), "Error with repository specified in project.", e );
}
ProjectBuilderConfiguration config = new DefaultProjectBuilderConfiguration().setLocalRepository( localRepository );
ProjectBuilderConfiguration config = new DefaultProjectBuilderConfiguration()
.setLocalRepository( localRepository )
.setRemoteRepositories( remoteRepositories );
project = readModelFromLocalPath( "unknown", artifact.getFile(), config.getLocalRepository(), artifactRepositories, config );
project = buildWithProfiles( project.getModel(), config, artifact.getFile(), project.getParentFile() );