reduce number of classes holding on to localRepository unnecessarily

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163339 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-02-08 04:12:58 +00:00
parent 797291178f
commit d783d9ce98
10 changed files with 13 additions and 36 deletions

View File

@ -1,6 +1,7 @@
package org.apache.maven.artifact.metadata;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;
import java.util.Set;
@ -31,6 +32,6 @@ import java.util.Set;
*/
public interface ArtifactMetadataSource
{
Set retrieve( Artifact artifact, Set remoteRepositories )
Set retrieve( Artifact artifact, ArtifactRepository localRepository, Set remoteRepositories )
throws ArtifactMetadataRetrievalException;
}

View File

@ -227,7 +227,7 @@ public class DefaultArtifactResolver
try
{
referencedDependencies = source.retrieve( newArtifact, remoteRepositories );
referencedDependencies = source.retrieve( newArtifact, localRepository, remoteRepositories, source.localRepository );
}
catch ( ArtifactMetadataRetrievalException e )
{

View File

@ -21,6 +21,7 @@ import org.apache.maven.artifact.ArtifactComponentTestCase;
import org.apache.maven.artifact.DefaultArtifact;
import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
import org.apache.maven.artifact.repository.ArtifactRepository;
import java.util.HashSet;
import java.util.Set;
@ -137,7 +138,7 @@ public class ArtifactResolverTest
ArtifactMetadataSource mds = new ArtifactMetadataSource()
{
public Set retrieve( Artifact artifact, Set remoteRepositories )
public Set retrieve( Artifact artifact, ArtifactRepository localRepository, Set remoteRepositories )
throws ArtifactMetadataRetrievalException
{
Set dependencies = new HashSet();
@ -185,7 +186,7 @@ public class ArtifactResolverTest
ArtifactMetadataSource mds = new ArtifactMetadataSource()
{
public Set retrieve( Artifact artifact, Set remoteRepositories )
public Set retrieve( Artifact artifact, ArtifactRepository localRepository, Set remoteRepositories )
throws ArtifactMetadataRetrievalException
{
Set dependencies = new HashSet();

View File

@ -39,22 +39,15 @@ public class MavenMetadataSource
implements ArtifactMetadataSource
{
private MavenProjectBuilder mavenProjectBuilder;
// private MavenXpp3Reader reader = new MavenXpp3Reader();
private ArtifactRepository localRepository;
private ArtifactResolver artifactResolver;
public MavenMetadataSource( ArtifactRepository localRepository,
ArtifactResolver artifactResolver,
MavenProjectBuilder projectBuilder )
public MavenMetadataSource( ArtifactResolver artifactResolver, MavenProjectBuilder projectBuilder )
{
this.localRepository = localRepository;
this.artifactResolver = artifactResolver;
this.mavenProjectBuilder = projectBuilder;
}
public Set retrieve( Artifact artifact, Set remoteRepositories )
public Set retrieve( Artifact artifact, ArtifactRepository localRepository, Set remoteRepositories )
throws ArtifactMetadataRetrievalException
{
Set artifacts;
@ -63,7 +56,7 @@ public class MavenMetadataSource
artifact.getVersion(),
"pom" );
try
{
{
artifactResolver.resolve( metadataArtifact, remoteRepositories, localRepository );
// [jdcasey/03-Feb-2005]: Replacing with ProjectBuilder, to enable

View File

@ -32,6 +32,7 @@ import java.util.Properties;
public class AbstractMavenExecutionRequest
implements MavenExecutionRequest
{
// @todo [BP] is this required? This hands off to MavenSession, but could be passed through the handler.handle function (+ createSession)
protected ArtifactRepository localRepository;
protected final Properties parameters;
protected List goals;

View File

@ -82,8 +82,7 @@ public class DependencyResolutionPhase
projectBuilder = (MavenProjectBuilder) context.lookup( MavenProjectBuilder.ROLE );
MavenMetadataSource sourceReader = new MavenMetadataSource( context.getLocalRepository(),
artifactResolver,
MavenMetadataSource sourceReader = new MavenMetadataSource( artifactResolver,
projectBuilder );
ArtifactResolutionResult result = artifactResolver.resolveTransitively( project.getArtifacts(),

View File

@ -214,8 +214,7 @@ public class DefaultPluginManager
mavenProjectBuilder = (MavenProjectBuilder) container.lookup( MavenProjectBuilder.ROLE );
MavenMetadataSource metadataSource = new MavenMetadataSource( session.getLocalRepository(),
artifactResolver,
MavenMetadataSource metadataSource = new MavenMetadataSource( artifactResolver,
mavenProjectBuilder );
( (ArtifactEnabledContainer) container ).addComponent( pluginArtifact,

View File

@ -118,8 +118,6 @@ public class DefaultMavenProjectBuilder
projectDefaultsInjector.injectDefaults( project );
project.setLocalRepository( localRepository );
project.setArtifacts( artifactFactory.createArtifacts( project.getDependencies(),
localRepository ) );
@ -142,8 +140,7 @@ public class DefaultMavenProjectBuilder
{
Set repos = RepositoryUtils.mavenToWagon( project.getRepositories() );
MavenMetadataSource sourceReader = new MavenMetadataSource( localRepository,
artifactResolver, this );
MavenMetadataSource sourceReader = new MavenMetadataSource( artifactResolver, this );
ArtifactResolutionResult result = artifactResolver.resolveTransitively( project
.getArtifacts(), repos, localRepository, sourceReader );

View File

@ -18,7 +18,6 @@ package org.apache.maven.project;
*/
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.model.Build;
import org.apache.maven.model.CiManagement;
import org.apache.maven.model.Contributor;
@ -64,8 +63,6 @@ public class MavenProject
private Set artifacts;
private ArtifactRepository wagonLocalRepository;
public MavenProject( Model model )
{
this.model = model;
@ -520,16 +517,6 @@ public class MavenProject
return model.getRepositories();
}
public void setLocalRepository( ArtifactRepository repository )
{
this.wagonLocalRepository = repository;
}
public ArtifactRepository getLocalRepository()
{
return wagonLocalRepository;
}
// ----------------------------------------------------------------------
// Decorators
// ----------------------------------------------------------------------

View File

@ -76,7 +76,6 @@ public class RegexBasedProjectInterpolator
}
MavenProject newProject = new MavenProject( model );
newProject.setLocalRepository( project.getLocalRepository() );
newProject.setParent( project.getParent() );
newProject.setFile( project.getFile() );
newProject.setArtifacts( project.getArtifacts() );