mirror of https://github.com/apache/maven.git
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:
parent
b746b13a69
commit
83720e04ca
|
@ -98,7 +98,6 @@ import org.codehaus.plexus.component.repository.exception.ComponentRepositoryExc
|
||||||
import org.codehaus.plexus.configuration.PlexusConfiguration;
|
import org.codehaus.plexus.configuration.PlexusConfiguration;
|
||||||
import org.codehaus.plexus.configuration.PlexusConfigurationException;
|
import org.codehaus.plexus.configuration.PlexusConfigurationException;
|
||||||
import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
|
import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
|
||||||
import org.codehaus.plexus.logging.AbstractLogEnabled;
|
|
||||||
import org.codehaus.plexus.logging.Logger;
|
import org.codehaus.plexus.logging.Logger;
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
import org.codehaus.plexus.util.StringUtils;
|
||||||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||||
|
@ -170,23 +169,15 @@ public class DefaultPluginManager
|
||||||
//
|
//
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
public Plugin getPluginDefinitionForPrefix( String prefix,
|
public Plugin getPluginDefinitionForPrefix( String prefix, MavenSession session, MavenProject project )
|
||||||
MavenSession session,
|
|
||||||
MavenProject project )
|
|
||||||
{
|
{
|
||||||
// TODO: since this is only used in the lifecycle executor, maybe it should be moved there? There is no other
|
// 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
|
// use for the mapping manager in here
|
||||||
return pluginMappingManager.getByPrefix( prefix, session.getPluginGroups(),
|
return pluginMappingManager.getByPrefix( prefix, session.getPluginGroups(), project.getRemoteArtifactRepositories(), session.getLocalRepository() );
|
||||||
project.getRemoteArtifactRepositories(),
|
|
||||||
session.getLocalRepository() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public PluginDescriptor verifyPlugin( Plugin plugin,
|
public PluginDescriptor verifyPlugin( Plugin plugin, MavenProject project, MavenSession session )
|
||||||
MavenProject project,
|
throws ArtifactResolutionException, PluginVersionResolutionException, ArtifactNotFoundException, InvalidPluginException, PluginManagerException, PluginNotFoundException, PluginVersionNotFoundException
|
||||||
MavenSession session )
|
|
||||||
throws ArtifactResolutionException, PluginVersionResolutionException,
|
|
||||||
ArtifactNotFoundException, InvalidPluginException,
|
|
||||||
PluginManagerException, PluginNotFoundException, PluginVersionNotFoundException
|
|
||||||
{
|
{
|
||||||
String pluginVersion = plugin.getVersion();
|
String pluginVersion = plugin.getVersion();
|
||||||
|
|
||||||
|
|
|
@ -78,11 +78,8 @@ public class DefaultPluginManagerSupport
|
||||||
|
|
||||||
private Context containerContext;
|
private Context containerContext;
|
||||||
|
|
||||||
public Artifact resolvePluginArtifact( Plugin plugin,
|
public Artifact resolvePluginArtifact( Plugin plugin, MavenProject project, MavenSession session )
|
||||||
MavenProject project,
|
throws PluginManagerException, InvalidPluginException, PluginVersionResolutionException, ArtifactResolutionException, ArtifactNotFoundException
|
||||||
MavenSession session )
|
|
||||||
throws PluginManagerException, InvalidPluginException, PluginVersionResolutionException,
|
|
||||||
ArtifactResolutionException, ArtifactNotFoundException
|
|
||||||
{
|
{
|
||||||
ArtifactRepository localRepository = session.getLocalRepository();
|
ArtifactRepository localRepository = session.getLocalRepository();
|
||||||
|
|
||||||
|
@ -102,12 +99,9 @@ public class DefaultPluginManagerSupport
|
||||||
|
|
||||||
if(pluginProject == null)
|
if(pluginProject == null)
|
||||||
{
|
{
|
||||||
pluginProject = buildPluginProject( plugin,
|
pluginProject = buildPluginProject( plugin, localRepository, remoteRepositories );
|
||||||
localRepository,
|
|
||||||
remoteRepositories );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
checkRequiredMavenVersion( plugin, pluginProject, localRepository, remoteRepositories );
|
checkRequiredMavenVersion( plugin, pluginProject, localRepository, remoteRepositories );
|
||||||
|
|
||||||
checkPluginDependencySpec( plugin, pluginProject );
|
checkPluginDependencySpec( plugin, pluginProject );
|
||||||
|
@ -116,8 +110,7 @@ public class DefaultPluginManagerSupport
|
||||||
|
|
||||||
pluginArtifact = project.replaceWithActiveArtifact( pluginArtifact );
|
pluginArtifact = project.replaceWithActiveArtifact( pluginArtifact );
|
||||||
|
|
||||||
ArtifactResolutionRequest request =
|
ArtifactResolutionRequest request = new ArtifactResolutionRequest( pluginArtifact, localRepository, remoteRepositories );
|
||||||
new ArtifactResolutionRequest( pluginArtifact, localRepository, remoteRepositories );
|
|
||||||
ArtifactResolutionResult result = repositorySystem.resolve( request );
|
ArtifactResolutionResult result = repositorySystem.resolve( request );
|
||||||
resolutionErrorHandler.throwErrors( request, result );
|
resolutionErrorHandler.throwErrors( request, result );
|
||||||
|
|
||||||
|
@ -130,9 +123,7 @@ public class DefaultPluginManagerSupport
|
||||||
Artifact artifact = repositorySystem.createProjectArtifact( plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion() );
|
Artifact artifact = repositorySystem.createProjectArtifact( plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion() );
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return mavenProjectBuilder.buildFromRepository( artifact,
|
return mavenProjectBuilder.buildFromRepository( artifact, remoteRepositories, localRepository );
|
||||||
remoteRepositories,
|
|
||||||
localRepository );
|
|
||||||
}
|
}
|
||||||
catch ( ProjectBuildingException e )
|
catch ( ProjectBuildingException e )
|
||||||
{
|
{
|
||||||
|
|
|
@ -208,7 +208,7 @@ public class DefaultMavenProjectBuilder
|
||||||
return buildFromRepository( artifact, remoteArtifactRepositories, localRepository );
|
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
|
throws ProjectBuildingException
|
||||||
{
|
{
|
||||||
MavenProject project = hm.get( artifact.getId() );
|
MavenProject project = hm.get( artifact.getId() );
|
||||||
|
@ -218,7 +218,7 @@ public class DefaultMavenProjectBuilder
|
||||||
return project;
|
return project;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ArtifactRepository> artifactRepositories = new ArrayList<ArtifactRepository>( remoteArtifactRepositories );
|
List<ArtifactRepository> artifactRepositories = new ArrayList<ArtifactRepository>( remoteRepositories );
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
artifactRepositories.addAll( repositorySystem.buildArtifactRepositories( getSuperModel().getRepositories() ) );
|
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 );
|
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 = readModelFromLocalPath( "unknown", artifact.getFile(), config.getLocalRepository(), artifactRepositories, config );
|
||||||
project = buildWithProfiles( project.getModel(), config, artifact.getFile(), project.getParentFile() );
|
project = buildWithProfiles( project.getModel(), config, artifact.getFile(), project.getParentFile() );
|
||||||
|
|
Loading…
Reference in New Issue