mirror of https://github.com/apache/maven.git
o removing any notions of the local repository from MavenProject, not the
right place for it. git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@162967 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
cc783005c1
commit
133a51a629
|
@ -4,7 +4,6 @@ import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
|
||||||
import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
|
import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
import org.apache.maven.artifact.resolver.ArtifactResolver;
|
import org.apache.maven.artifact.resolver.ArtifactResolver;
|
||||||
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
|
||||||
import org.apache.maven.model.Dependency;
|
import org.apache.maven.model.Dependency;
|
||||||
import org.apache.maven.model.Model;
|
import org.apache.maven.model.Model;
|
||||||
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
|
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
|
||||||
|
@ -64,8 +63,6 @@ public class MavenMetadataSource
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// This is using the current format for the metadata
|
|
||||||
|
|
||||||
Artifact metadataArtifact = new DefaultArtifact( artifact.getGroupId(),
|
Artifact metadataArtifact = new DefaultArtifact( artifact.getGroupId(),
|
||||||
artifact.getArtifactId(),
|
artifact.getArtifactId(),
|
||||||
artifact.getVersion(),
|
artifact.getVersion(),
|
||||||
|
@ -80,7 +77,6 @@ public class MavenMetadataSource
|
||||||
catch ( Exception e )
|
catch ( Exception e )
|
||||||
{
|
{
|
||||||
throw new ArtifactMetadataRetrievalException( "Cannot read artifact source: ", e );
|
throw new ArtifactMetadataRetrievalException( "Cannot read artifact source: ", e );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return artifacts;
|
return artifacts;
|
||||||
|
|
|
@ -548,45 +548,9 @@ public class MavenProject
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
* @todo create something like MavenContants class and put "maven.repo.local"
|
|
||||||
* @todo In fact I am not sure if this object should be used for accessing the information
|
|
||||||
* where maven local repository is. There should be only one local repository and it
|
|
||||||
* should be shared between all projects. Probably we can have a component like
|
|
||||||
* MavenEnvinromnent which will contain all behavioral settings shared between projects.
|
|
||||||
* This component can read on the startup ${user.home}/build.properties file
|
|
||||||
* <p/>
|
|
||||||
* <p/>
|
|
||||||
* there
|
|
||||||
*/
|
|
||||||
public String getLocalRepository()
|
|
||||||
{
|
|
||||||
return getProperty( "maven.repo.local" );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLocalRepository( String path )
|
|
||||||
{
|
|
||||||
properties.put( "maven.repo.local", path );
|
|
||||||
}
|
|
||||||
|
|
||||||
public List getRepositories()
|
public List getRepositories()
|
||||||
{
|
{
|
||||||
return model.getRepositories();
|
return model.getRepositories();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addRepository( Repository repository )
|
|
||||||
{
|
|
||||||
model.getRepositories().add( repository );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addRepository( String url )
|
|
||||||
{
|
|
||||||
Repository repository = new Repository();
|
|
||||||
|
|
||||||
repository.setUrl( url );
|
|
||||||
|
|
||||||
addRepository( repository );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,20 +71,4 @@ public class AbstractProjectTestCase
|
||||||
{
|
{
|
||||||
return buildProject( f, localRepository, false );
|
return buildProject( f, localRepository, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initRemoteRepositories( MavenProject project )
|
|
||||||
{
|
|
||||||
//we will remove ibiblio
|
|
||||||
project.getRepositories().clear();
|
|
||||||
|
|
||||||
File repo_1 = new File( getBasedir(), "target/test-classes/remote-repo-1" );
|
|
||||||
|
|
||||||
File repo_2 = new File( getBasedir(), "target/test-classes/remote-repo-2" );
|
|
||||||
|
|
||||||
project.addRepository( "file://" + repo_1.getPath() );
|
|
||||||
|
|
||||||
project.addRepository( "file://" + repo_2.getPath() );
|
|
||||||
|
|
||||||
assertEquals( 2, project.getRepositories().size() );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue