o Cleaned up code

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@995585 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2010-09-09 21:52:50 +00:00
parent 8e5e2912ba
commit b4916c20e9
7 changed files with 4 additions and 218 deletions

View File

@ -95,7 +95,6 @@ public class DefaultMavenProjectBuilder
if ( session != null )
{
request.setRepositorySession( session.getRepositorySession() );
request.setOffline( session.isOffline() );
request.setSystemProperties( session.getSystemProperties() );
if ( request.getUserProperties().isEmpty() )
{
@ -105,11 +104,7 @@ public class DefaultMavenProjectBuilder
MavenExecutionRequest req = session.getRequest();
if ( req != null )
{
request.setServers( req.getServers() );
request.setMirrors( req.getMirrors() );
request.setProxies( req.getProxies() );
request.setRemoteRepositories( req.getRemoteRepositories() );
request.setForceUpdate( req.isUpdateSnapshots() );
}
}
else

View File

@ -958,11 +958,6 @@ public class DefaultMavenExecutionRequest
projectBuildingRequest.setUserProperties( getUserProperties() );
projectBuildingRequest.setRemoteRepositories( getRemoteRepositories() );
projectBuildingRequest.setPluginArtifactRepositories( getPluginArtifactRepositories() );
projectBuildingRequest.setOffline( isOffline() );
projectBuildingRequest.setForceUpdate( isUpdateSnapshots() );
projectBuildingRequest.setServers( getServers() );
projectBuildingRequest.setMirrors( getMirrors() );
projectBuildingRequest.setProxies( getProxies() );
projectBuildingRequest.setActiveProfileIds( getActiveProfiles() );
projectBuildingRequest.setInactiveProfileIds( getInactiveProfiles() );
projectBuildingRequest.setProfiles( getProfiles() );

View File

@ -28,9 +28,6 @@ import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.model.Profile;
import org.apache.maven.model.building.ModelBuildingRequest;
import org.apache.maven.repository.ArtifactTransferListener;
import org.apache.maven.settings.Mirror;
import org.apache.maven.settings.Proxy;
import org.apache.maven.settings.Server;
import org.sonatype.aether.RepositorySystemSession;
public class DefaultProjectBuildingRequest
@ -39,22 +36,12 @@ public class DefaultProjectBuildingRequest
private RepositorySystemSession repositorySession;
private boolean offline;
private boolean forceUpdate;
private ArtifactRepository localRepository;
private List<ArtifactRepository> remoteRepositories;
private List<ArtifactRepository> pluginArtifactRepositories;
private List<Server> servers;
private List<Mirror> mirrors;
private List<Proxy> proxies;
private MavenProject project;
private int validationLevel = ModelBuildingRequest.VALIDATION_LEVEL_STRICT;
@ -87,9 +74,6 @@ public class DefaultProjectBuildingRequest
userProperties = new Properties();
remoteRepositories = new ArrayList<ArtifactRepository>();
pluginArtifactRepositories = new ArrayList<ArtifactRepository>();
servers = new ArrayList<Server>();
mirrors = new ArrayList<Mirror>();
proxies = new ArrayList<Proxy>();
}
public MavenProject getProject()
@ -102,30 +86,6 @@ public class DefaultProjectBuildingRequest
this.project = mavenProject;
}
public DefaultProjectBuildingRequest setOffline( boolean offline )
{
this.offline = offline;
return this;
}
public boolean isOffline()
{
return offline;
}
public boolean isForceUpdate()
{
return forceUpdate;
}
public ProjectBuildingRequest setForceUpdate( boolean forceUpdate )
{
this.forceUpdate = forceUpdate;
return this;
}
public ProjectBuildingRequest setLocalRepository( ArtifactRepository localRepository )
{
this.localRepository = localRepository;
@ -175,63 +135,6 @@ public class DefaultProjectBuildingRequest
return this;
}
public ProjectBuildingRequest setServers( List<Server> servers )
{
if ( servers != null )
{
this.servers = new ArrayList<Server>( servers );
}
else
{
this.servers.clear();
}
return this;
}
public List<Server> getServers()
{
return servers;
}
public ProjectBuildingRequest setMirrors( List<Mirror> mirrors )
{
if ( mirrors != null )
{
this.mirrors = new ArrayList<Mirror>( mirrors );
}
else
{
this.mirrors.clear();
}
return this;
}
public List<Mirror> getMirrors()
{
return mirrors;
}
public ProjectBuildingRequest setProxies( List<Proxy> proxies )
{
if ( proxies != null )
{
this.proxies = new ArrayList<Proxy>( proxies );
}
else
{
this.proxies.clear();
}
return this;
}
public List<Proxy> getProxies()
{
return proxies;
}
public Properties getSystemProperties()
{
return systemProperties;

View File

@ -26,22 +26,11 @@ import java.util.Properties;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.model.Profile;
import org.apache.maven.model.building.ModelBuildingRequest;
import org.apache.maven.settings.Mirror;
import org.apache.maven.settings.Proxy;
import org.apache.maven.settings.Server;
import org.sonatype.aether.RepositorySystemSession;
public interface ProjectBuildingRequest
{
ProjectBuildingRequest setOffline( boolean offline );
boolean isOffline();
ProjectBuildingRequest setForceUpdate( boolean forceUpdate );
boolean isForceUpdate();
ProjectBuildingRequest setLocalRepository( ArtifactRepository localRepository );
ArtifactRepository getLocalRepository();
@ -54,18 +43,6 @@ public interface ProjectBuildingRequest
List<ArtifactRepository> getPluginArtifactRepositories();
ProjectBuildingRequest setServers( List<Server> servers );
List<Server> getServers();
ProjectBuildingRequest setMirrors( List<Mirror> mirrors );
List<Mirror> getMirrors();
ProjectBuildingRequest setProxies( List<Proxy> proxies );
List<Proxy> getProxies();
/**
* Sets the system properties to use for interpolation and profile activation. The system properties are collected
* from the runtime environment like {@link System#getProperties()} and environment variables.

View File

@ -76,6 +76,8 @@ import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
import org.codehaus.plexus.logging.Logger;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.repository.RepositoryPolicy;
import org.sonatype.aether.transfer.ArtifactNotFoundException;
/**
@ -109,14 +111,12 @@ public class MavenMetadataSource
private void injectSession( MetadataResolutionRequest request )
{
MavenSession session = legacySupport.getSession();
RepositorySystemSession session = legacySupport.getRepositorySession();
if ( session != null )
{
request.setOffline( session.isOffline() );
request.setServers( session.getRequest().getServers() );
request.setMirrors( session.getRequest().getMirrors() );
request.setProxies( session.getRequest().getProxies() );
request.setForceUpdate( RepositoryPolicy.UPDATE_POLICY_ALWAYS.equals( session.getUpdatePolicy() ) );
}
}
@ -571,14 +571,9 @@ public class MavenMetadataSource
ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest();
configuration.setLocalRepository( repositoryRequest.getLocalRepository() );
configuration.setRemoteRepositories( repositoryRequest.getRemoteRepositories() );
configuration.setOffline( repositoryRequest.isOffline() );
configuration.setForceUpdate( repositoryRequest.isForceUpdate() );
configuration.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL );
configuration.setProcessPlugins( false );
configuration.setSystemProperties( getSystemProperties() );
configuration.setServers( repositoryRequest.getServers() );
configuration.setMirrors( repositoryRequest.getMirrors() );
configuration.setProxies( repositoryRequest.getProxies() );
configuration.setRepositorySession( legacySupport.getRepositorySession() );
project = getProjectBuilder().build( pomArtifact, configuration ).getProject();

View File

@ -19,7 +19,6 @@ package org.apache.maven.repository.legacy.metadata;
* under the License.
*/
import java.util.ArrayList;
import java.util.List;
import org.apache.maven.artifact.Artifact;
@ -27,9 +26,6 @@ import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.DefaultRepositoryRequest;
import org.apache.maven.artifact.repository.RepositoryRequest;
import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
import org.apache.maven.settings.Mirror;
import org.apache.maven.settings.Proxy;
import org.apache.maven.settings.Server;
/**
* Forms a request to retrieve artifact metadata.
@ -46,12 +42,6 @@ public class DefaultMetadataResolutionRequest
private RepositoryRequest repositoryRequest;
private List<Server> servers;
private List<Mirror> mirrors;
private List<Proxy> proxies;
public DefaultMetadataResolutionRequest()
{
repositoryRequest = new DefaultRepositoryRequest();
@ -65,9 +55,6 @@ public class DefaultMetadataResolutionRequest
public DefaultMetadataResolutionRequest( ArtifactResolutionRequest resolutionRequest )
{
this.repositoryRequest = new DefaultRepositoryRequest( resolutionRequest );
setServers( resolutionRequest.getServers() );
setMirrors( resolutionRequest.getMirrors() );
setProxies( resolutionRequest.getProxies() );
}
public Artifact getArtifact()
@ -142,55 +129,4 @@ public class DefaultMetadataResolutionRequest
return this;
}
public MetadataResolutionRequest setServers( List<Server> servers )
{
this.servers = servers;
return this;
}
public List<Server> getServers()
{
if ( servers == null )
{
servers = new ArrayList<Server>();
}
return servers;
}
public MetadataResolutionRequest setMirrors( List<Mirror> mirrors )
{
this.mirrors = mirrors;
return this;
}
public List<Mirror> getMirrors()
{
if ( mirrors == null )
{
mirrors = new ArrayList<Mirror>();
}
return mirrors;
}
public MetadataResolutionRequest setProxies( List<Proxy> proxies )
{
this.proxies = proxies;
return this;
}
public List<Proxy> getProxies()
{
if ( proxies == null )
{
proxies = new ArrayList<Proxy>();
}
return proxies;
}
}

View File

@ -24,9 +24,6 @@ import java.util.List;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.RepositoryRequest;
import org.apache.maven.settings.Mirror;
import org.apache.maven.settings.Proxy;
import org.apache.maven.settings.Server;
/**
* Forms a request to retrieve artifact metadata.
@ -113,16 +110,4 @@ public interface MetadataResolutionRequest
*/
MetadataResolutionRequest setResolveManagedVersions( boolean resolveManagedVersions );
MetadataResolutionRequest setServers( List<Server> servers );
List<Server> getServers();
MetadataResolutionRequest setMirrors( List<Mirror> mirrors );
List<Mirror> getMirrors();
MetadataResolutionRequest setProxies( List<Proxy> proxies );
List<Proxy> getProxies();
}