mirror of https://github.com/apache/archiva.git
[MRM-138] correct repository handling
git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@428688 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c65e5768a5
commit
b7a2a19229
|
@ -51,8 +51,7 @@ public class DefaultConfiguredRepositoryFactory
|
|||
String repoDir = repositoryDirectory.toURI().toString();
|
||||
|
||||
ArtifactRepositoryLayout layout = (ArtifactRepositoryLayout) repositoryLayouts.get( configuration.getLayout() );
|
||||
// TODO! real ID
|
||||
return repoFactory.createArtifactRepository( "test", repoDir, layout, null, null );
|
||||
return repoFactory.createArtifactRepository( configuration.getId(), repoDir, layout, null, null );
|
||||
}
|
||||
|
||||
public List createRepositories( Configuration configuration )
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.maven.repository.manager.web.action;
|
|||
import com.opensymphony.xwork.ActionSupport;
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.factory.ArtifactFactory;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.apache.maven.project.MavenProjectBuilder;
|
||||
|
@ -27,9 +28,11 @@ import org.apache.maven.repository.configuration.Configuration;
|
|||
import org.apache.maven.repository.configuration.ConfigurationStore;
|
||||
import org.apache.maven.repository.configuration.ConfigurationStoreException;
|
||||
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.xml.pull.XmlPullParserException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -98,13 +101,23 @@ public class ShowArtifactAction
|
|||
|
||||
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
|
||||
MavenProject project = projectBuilder.buildFromRepository( artifact, repositories, null );
|
||||
MavenProject project = projectBuilder.buildFromRepository( artifact, repositories, getLocalRepository() );
|
||||
|
||||
model = project.getModel();
|
||||
|
||||
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()
|
||||
{
|
||||
return model;
|
||||
|
|
Loading…
Reference in New Issue