mirror of https://github.com/apache/archiva.git
[MRM-138] move local repository to a permanent location
git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@428694 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b7a2a19229
commit
8a6d97d0fa
|
@ -24,6 +24,14 @@
|
||||||
<multiplicity>*</multiplicity>
|
<multiplicity>*</multiplicity>
|
||||||
</association>
|
</association>
|
||||||
</field>
|
</field>
|
||||||
|
<field>
|
||||||
|
<name>localRepository</name>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<type>String</type>
|
||||||
|
<description>
|
||||||
|
The location of the local repository.
|
||||||
|
</description>
|
||||||
|
</field>
|
||||||
<field>
|
<field>
|
||||||
<name>indexPath</name>
|
<name>indexPath</name>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
|
@ -67,6 +75,11 @@
|
||||||
<codeSegment>
|
<codeSegment>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
<code><![CDATA[
|
<code><![CDATA[
|
||||||
|
public Configuration()
|
||||||
|
{
|
||||||
|
localRepository = new java.io.File( System.getProperty( "user.home" ), ".m2/repository" ).getAbsolutePath();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isValid()
|
public boolean isValid()
|
||||||
{
|
{
|
||||||
boolean valid = true;
|
boolean valid = true;
|
||||||
|
|
|
@ -44,4 +44,12 @@ public interface ConfiguredRepositoryFactory
|
||||||
* @return the artifact repositories
|
* @return the artifact repositories
|
||||||
*/
|
*/
|
||||||
List createRepositories( Configuration configuration );
|
List createRepositories( Configuration configuration );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a local repository from the given configuration.
|
||||||
|
*
|
||||||
|
* @param configuration the configuration
|
||||||
|
* @return the local artifact repository
|
||||||
|
*/
|
||||||
|
ArtifactRepository createLocalRepository( Configuration configuration );
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,4 +65,10 @@ public class DefaultConfiguredRepositoryFactory
|
||||||
|
|
||||||
return repositories;
|
return repositories;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ArtifactRepository createLocalRepository( Configuration configuration )
|
||||||
|
{
|
||||||
|
ArtifactRepositoryLayout layout = (ArtifactRepositoryLayout) repositoryLayouts.get( "default" );
|
||||||
|
return repoFactory.createArtifactRepository( "local", configuration.getLocalRepository(), layout, null, null );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,6 +64,12 @@
|
||||||
<artifactId>plexus-log4j-logging</artifactId>
|
<artifactId>plexus-log4j-logging</artifactId>
|
||||||
<version>1.1-alpha-2</version>
|
<version>1.1-alpha-2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven.wagon</groupId>
|
||||||
|
<artifactId>wagon-file</artifactId>
|
||||||
|
<version>1.0-beta-1</version>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.codehaus.plexus</groupId>
|
<groupId>org.codehaus.plexus</groupId>
|
||||||
<artifactId>plexus-container-default</artifactId>
|
<artifactId>plexus-container-default</artifactId>
|
||||||
|
|
|
@ -28,11 +28,9 @@ import org.apache.maven.repository.configuration.Configuration;
|
||||||
import org.apache.maven.repository.configuration.ConfigurationStore;
|
import org.apache.maven.repository.configuration.ConfigurationStore;
|
||||||
import org.apache.maven.repository.configuration.ConfigurationStoreException;
|
import org.apache.maven.repository.configuration.ConfigurationStoreException;
|
||||||
import org.apache.maven.repository.configuration.ConfiguredRepositoryFactory;
|
import org.apache.maven.repository.configuration.ConfiguredRepositoryFactory;
|
||||||
import org.apache.maven.repository.configuration.RepositoryConfiguration;
|
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
import org.codehaus.plexus.util.StringUtils;
|
||||||
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -101,23 +99,14 @@ public class ShowArtifactAction
|
||||||
|
|
||||||
Artifact artifact = artifactFactory.createProjectArtifact( groupId, artifactId, version );
|
Artifact artifact = artifactFactory.createProjectArtifact( groupId, artifactId, version );
|
||||||
// TODO: maybe we can decouple the assembly parts of the project builder from the repository handling to get rid of the temp repo
|
// TODO: maybe we can decouple the assembly parts of the project builder from the repository handling to get rid of the temp repo
|
||||||
MavenProject project = projectBuilder.buildFromRepository( artifact, repositories, getLocalRepository() );
|
ArtifactRepository localRepository = repositoryFactory.createLocalRepository( configuration );
|
||||||
|
MavenProject project = projectBuilder.buildFromRepository( artifact, repositories, localRepository );
|
||||||
|
|
||||||
model = project.getModel();
|
model = project.getModel();
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ArtifactRepository getLocalRepository()
|
|
||||||
throws IOException
|
|
||||||
{
|
|
||||||
// TODO: do we want this to be configurable?
|
|
||||||
RepositoryConfiguration configuration = new RepositoryConfiguration();
|
|
||||||
configuration.setId( "local" );
|
|
||||||
configuration.setDirectory( File.createTempFile( "repository", "local" ).getAbsolutePath() );
|
|
||||||
return repositoryFactory.createRepository( configuration );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Model getModel()
|
public Model getModel()
|
||||||
{
|
{
|
||||||
return model;
|
return model;
|
||||||
|
|
Loading…
Reference in New Issue