mirror of https://github.com/apache/maven.git
[MNG-4191] separate plugin and artifact repositories
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@783480 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6c4561f7ed
commit
ea7d1088e9
|
@ -249,7 +249,7 @@ public class DefaultLifecycleExecutor
|
|||
// org.apache.maven.plugins:maven-remote-resources-plugin:1.0:process
|
||||
//
|
||||
MojoDescriptor mojoDescriptor = pluginManager.getMojoDescriptor( mojoExecution.getPlugin(), mojoExecution.getGoal(), session
|
||||
.getLocalRepository(), project.getRemoteArtifactRepositories() );
|
||||
.getLocalRepository(), project.getPluginArtifactRepositories() );
|
||||
|
||||
PluginDescriptor pluginDescriptor = mojoDescriptor.getPluginDescriptor();
|
||||
if ( pluginDescriptor.getPlugin().isExtensions() )
|
||||
|
@ -402,7 +402,7 @@ public class DefaultLifecycleExecutor
|
|||
{
|
||||
for ( String goal : execution.getGoals() )
|
||||
{
|
||||
MojoDescriptor mojoDescriptor = pluginManager.getMojoDescriptor( plugin, goal, session.getLocalRepository(), project.getRemoteArtifactRepositories() );
|
||||
MojoDescriptor mojoDescriptor = pluginManager.getMojoDescriptor( plugin, goal, session.getLocalRepository(), project.getPluginArtifactRepositories() );
|
||||
|
||||
if ( mojoDescriptor.getPhase() != null && phaseToMojoMapping.get( mojoDescriptor.getPhase() ) != null )
|
||||
{
|
||||
|
@ -673,7 +673,7 @@ public class DefaultLifecycleExecutor
|
|||
//
|
||||
//TODO: we should cycle through the repositories but take the repository which actually
|
||||
// satisfied the prefix.
|
||||
for ( ArtifactRepository repository : project.getRemoteArtifactRepositories() )
|
||||
for ( ArtifactRepository repository : project.getPluginArtifactRepositories() )
|
||||
{
|
||||
localPath = plugin.getGroupId().replace( '.', '/' ) + "/" + plugin.getArtifactId() + "/maven-metadata-" + repository.getId() + ".xml";
|
||||
|
||||
|
@ -733,7 +733,7 @@ public class DefaultLifecycleExecutor
|
|||
}
|
||||
}
|
||||
|
||||
return pluginManager.getMojoDescriptor( plugin, goal, session.getLocalRepository(), project.getRemoteArtifactRepositories() );
|
||||
return pluginManager.getMojoDescriptor( plugin, goal, session.getLocalRepository(), project.getPluginArtifactRepositories() );
|
||||
}
|
||||
|
||||
private String attemptToGetPluginVersionFromProject( Plugin plugin, MavenProject project )
|
||||
|
@ -999,7 +999,7 @@ public class DefaultLifecycleExecutor
|
|||
//
|
||||
for ( String pluginGroup : session.getPluginGroups() )
|
||||
{
|
||||
for ( ArtifactRepository repository : session.getCurrentProject().getRemoteArtifactRepositories() )
|
||||
for ( ArtifactRepository repository : session.getCurrentProject().getPluginArtifactRepositories() )
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -1032,7 +1032,7 @@ public class DefaultLifecycleExecutor
|
|||
|
||||
}
|
||||
|
||||
throw new NoPluginFoundForPrefixException( prefix, session.getLocalRepository(), session.getCurrentProject().getRemoteArtifactRepositories() );
|
||||
throw new NoPluginFoundForPrefixException( prefix, session.getLocalRepository(), session.getCurrentProject().getPluginArtifactRepositories() );
|
||||
}
|
||||
|
||||
// Keep track of the repository that provided the prefix mapping
|
||||
|
|
|
@ -124,7 +124,7 @@ public class DefaultProjectBuilder
|
|||
{
|
||||
if ( configuration.isProcessPlugins() )
|
||||
{
|
||||
lifecycle.populateDefaultConfigurationForPlugins( model.getBuild().getPlugins(), configuration.getLocalRepository(), project.getRemoteArtifactRepositories() );
|
||||
lifecycle.populateDefaultConfigurationForPlugins( model.getBuild().getPlugins(), configuration.getLocalRepository(), project.getPluginArtifactRepositories() );
|
||||
}
|
||||
}
|
||||
catch ( LifecycleExecutionException e )
|
||||
|
|
|
@ -106,6 +106,8 @@ public class MavenProject
|
|||
|
||||
private List<ArtifactRepository> remoteArtifactRepositories;
|
||||
|
||||
private List<ArtifactRepository> pluginArtifactRepositories;
|
||||
|
||||
private List<Artifact> attachedArtifacts;
|
||||
|
||||
private MavenProject executionProject;
|
||||
|
@ -244,11 +246,14 @@ public class MavenProject
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
pluginArtifactRepositories = new ArrayList<ArtifactRepository>();
|
||||
|
||||
for ( Repository r : model.getPluginRepositories() )
|
||||
{
|
||||
try
|
||||
{
|
||||
remoteArtifactRepositories.add( repositorySystem.buildArtifactRepository( r ) );
|
||||
pluginArtifactRepositories.add( repositorySystem.buildArtifactRepository( r ) );
|
||||
}
|
||||
catch ( InvalidRepositoryException e )
|
||||
{
|
||||
|
@ -262,6 +267,8 @@ public class MavenProject
|
|||
{
|
||||
remoteArtifactRepositories.addAll( projectBuilderConfiguration.getRemoteRepositories() );
|
||||
}
|
||||
|
||||
pluginArtifactRepositories = repositorySystem.getMirrors( pluginArtifactRepositories );
|
||||
}
|
||||
|
||||
// TODO: Find a way to use <relativePath/> here...it's tricky, because the moduleProject
|
||||
|
@ -390,7 +397,7 @@ public class MavenProject
|
|||
|
||||
public List<ArtifactRepository> getRemoteArtifactRepositories()
|
||||
{
|
||||
return new ArrayList<ArtifactRepository>( remoteArtifactRepositories );
|
||||
return remoteArtifactRepositories;
|
||||
}
|
||||
|
||||
public boolean hasParent()
|
||||
|
@ -1350,6 +1357,7 @@ public class MavenProject
|
|||
|
||||
public void setPluginArtifactRepositories( List<ArtifactRepository> pluginArtifactRepositories )
|
||||
{
|
||||
this.pluginArtifactRepositories = pluginArtifactRepositories;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1358,7 +1366,7 @@ public class MavenProject
|
|||
*/
|
||||
public List<ArtifactRepository> getPluginArtifactRepositories()
|
||||
{
|
||||
return getRemoteArtifactRepositories();
|
||||
return pluginArtifactRepositories;
|
||||
}
|
||||
|
||||
public ArtifactRepository getDistributionManagementArtifactRepository()
|
||||
|
|
|
@ -47,7 +47,7 @@ public class PluginManagerTest
|
|||
plugin.setGroupId( "org.codehaus.plexus" );
|
||||
plugin.setArtifactId( "plexus-component-metadata" );
|
||||
plugin.setVersion( plexusVersion );
|
||||
PluginDescriptor pluginDescriptor = pluginManager.loadPlugin( plugin, session.getLocalRepository(), session.getCurrentProject().getRemoteArtifactRepositories() );
|
||||
PluginDescriptor pluginDescriptor = pluginManager.loadPlugin( plugin, session.getLocalRepository(), session.getCurrentProject().getPluginArtifactRepositories() );
|
||||
assertNotNull( pluginDescriptor );
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ public class PluginManagerTest
|
|||
plugin.setArtifactId( "plexus-component-metadata" );
|
||||
plugin.setVersion( plexusVersion );
|
||||
|
||||
MojoDescriptor mojoDescriptor = pluginManager.getMojoDescriptor( plugin, goal, session.getLocalRepository(), session.getCurrentProject().getRemoteArtifactRepositories() );
|
||||
MojoDescriptor mojoDescriptor = pluginManager.getMojoDescriptor( plugin, goal, session.getLocalRepository(), session.getCurrentProject().getPluginArtifactRepositories() );
|
||||
assertNotNull( mojoDescriptor );
|
||||
assertEquals( "generate-metadata", mojoDescriptor.getGoal() );
|
||||
// igorf: plugin realm comes later
|
||||
|
|
Loading…
Reference in New Issue