[MNG-4191] separate plugin and artifact repositories

o Extended requests to allow for configuration of plugin repos

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@786790 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-06-20 10:29:51 +00:00
parent d30406e435
commit 34580df645
6 changed files with 67 additions and 8 deletions

View File

@ -105,6 +105,8 @@ public class DefaultMavenExecutionRequest
private List<ArtifactRepository> remoteRepositories;
private List<ArtifactRepository> pluginArtifactRepositories;
/**
* Suppress SNAPSHOT updates.
*
@ -144,6 +146,7 @@ public class DefaultMavenExecutionRequest
copy.setGlobalChecksumPolicy( original.getGlobalChecksumPolicy() );
copy.setUpdateSnapshots( original.isUpdateSnapshots() );
copy.setRemoteRepositories( original.getRemoteRepositories() );
copy.setPluginArtifactRepositories( original.getPluginArtifactRepositories() );
copy.setNoSnapshotUpdates( original.isNoSnapshotUpdates() );
return original;
}
@ -232,6 +235,14 @@ public class DefaultMavenExecutionRequest
return this;
}
public MavenExecutionRequest setPluginArtifactRepositories( List<ArtifactRepository> pluginArtifactRepositories )
{
getPluginArtifactRepositories().clear();
getPluginArtifactRepositories().addAll( pluginArtifactRepositories );
return this;
}
public void setProjectBuildingConfiguration( ProjectBuildingRequest projectBuildingConfiguration )
{
this.projectBuildingRequest = projectBuildingConfiguration;
@ -705,6 +716,15 @@ public class DefaultMavenExecutionRequest
return remoteRepositories;
}
public List<ArtifactRepository> getPluginArtifactRepositories()
{
if ( pluginArtifactRepositories == null )
{
pluginArtifactRepositories = new ArrayList<ArtifactRepository>();
}
return pluginArtifactRepositories;
}
//TODO: this does not belong here.
public ProjectBuildingRequest getProjectBuildingRequest()
{
@ -714,6 +734,7 @@ public class DefaultMavenExecutionRequest
projectBuildingRequest.setLocalRepository( getLocalRepository() );
projectBuildingRequest.setExecutionProperties( getProperties() );
projectBuildingRequest.setRemoteRepositories( getRemoteRepositories() );
projectBuildingRequest.setPluginArtifactRepositories( getPluginArtifactRepositories() );
projectBuildingRequest.setActiveProfileIds( getActiveProfiles() );
projectBuildingRequest.setInactiveProfileIds( getInactiveProfiles() );
projectBuildingRequest.setProfiles( getProfiles() );

View File

@ -199,6 +199,9 @@ public interface MavenExecutionRequest
MavenExecutionRequest setRemoteRepositories( List<ArtifactRepository> repositories );
List<ArtifactRepository> getRemoteRepositories();
MavenExecutionRequest setPluginArtifactRepositories( List<ArtifactRepository> repositories );
List<ArtifactRepository> getPluginArtifactRepositories();
File getUserToolchainsFile();
MavenExecutionRequest setUserToolchainsFile( File userToolchainsFile );

View File

@ -35,6 +35,8 @@ public class DefaultProjectBuildingRequest
private List<ArtifactRepository> remoteRepositories;
private List<ArtifactRepository> pluginArtifactRepositories;
private List<ModelEventListener> listeners;
private MavenProject topProject;
@ -60,6 +62,8 @@ public class DefaultProjectBuildingRequest
activeProfileIds = new ArrayList<String>();
inactiveProfileIds = new ArrayList<String>();
executionProperties = new Properties();
remoteRepositories = new ArrayList<ArtifactRepository>();
pluginArtifactRepositories = new ArrayList<ArtifactRepository>();
}
public MavenProject getTopLevelProjectFromReactor()
@ -85,16 +89,35 @@ public class DefaultProjectBuildingRequest
public List<ArtifactRepository> getRemoteRepositories()
{
if ( remoteRepositories == null )
{
remoteRepositories = new ArrayList<ArtifactRepository>();
}
return remoteRepositories;
}
public ProjectBuildingRequest setRemoteRepositories( List<ArtifactRepository> remoteRepositories )
{
this.remoteRepositories = remoteRepositories;
this.remoteRepositories.clear();
if ( remoteRepositories != null )
{
this.remoteRepositories.addAll( remoteRepositories );
}
return this;
}
public List<ArtifactRepository> getPluginArtifactRepositories()
{
return pluginArtifactRepositories;
}
public ProjectBuildingRequest setPluginArtifactRepositories( List<ArtifactRepository> pluginArtifactRepositories )
{
this.pluginArtifactRepositories.clear();
if ( pluginArtifactRepositories != null )
{
this.pluginArtifactRepositories.addAll( pluginArtifactRepositories );
}
return this;
}
@ -106,6 +129,7 @@ public class DefaultProjectBuildingRequest
public ProjectBuildingRequest setExecutionProperties( Properties executionProperties )
{
this.executionProperties.clear();
if ( executionProperties != null )
{
this.executionProperties.putAll( executionProperties );
@ -155,6 +179,7 @@ public class DefaultProjectBuildingRequest
public void setActiveProfileIds( List<String> activeProfileIds )
{
this.activeProfileIds.clear();
if ( activeProfileIds != null )
{
this.activeProfileIds.addAll( activeProfileIds );
@ -169,6 +194,7 @@ public class DefaultProjectBuildingRequest
public void setInactiveProfileIds( List<String> inactiveProfileIds )
{
this.inactiveProfileIds.clear();
if ( inactiveProfileIds != null )
{
this.inactiveProfileIds.addAll( inactiveProfileIds );
@ -178,6 +204,7 @@ public class DefaultProjectBuildingRequest
public void setProfiles( List<Profile> profiles )
{
this.profiles.clear();
if ( profiles != null )
{
this.profiles.addAll( profiles );

View File

@ -235,10 +235,12 @@ public class MavenProject
this.repositorySystem = repositorySystem;
originalModel = model;
remoteArtifactRepositories =
createArtifactRepositories( model.getRepositories(), projectBuilderConfiguration.getRemoteRepositories() );
remoteArtifactRepositories = projectBuilderConfiguration.getRemoteRepositories();
remoteArtifactRepositories = createArtifactRepositories( model.getRepositories(), remoteArtifactRepositories );
pluginArtifactRepositories = createArtifactRepositories( model.getPluginRepositories(), null );
pluginArtifactRepositories = projectBuilderConfiguration.getPluginArtifactRepositories();
pluginArtifactRepositories =
createArtifactRepositories( model.getPluginRepositories(), pluginArtifactRepositories );
}
//TODO: need to integrate the effective scope and refactor it out of the MMS

View File

@ -17,6 +17,10 @@ public interface ProjectBuildingRequest
List<ArtifactRepository> getRemoteRepositories();
ProjectBuildingRequest setPluginArtifactRepositories( List<ArtifactRepository> pluginArtifacgRepositories );
List<ArtifactRepository> getPluginArtifactRepositories();
ProjectBuildingRequest setExecutionProperties( Properties executionProperties );
Properties getExecutionProperties();

View File

@ -235,6 +235,8 @@ public class DefaultMavenExecutionRequestPopulator
// </mirrors>
request.setRemoteRepositories( repositorySystem.getMirrors( request.getRemoteRepositories() ) );
request.setPluginArtifactRepositories( repositorySystem.getMirrors( request.getPluginArtifactRepositories() ) );
}
// ------------------------------------------------------------------------