diff --git a/maven-repository-core/src/main/java/org/apache/maven/repository/configuration/DefaultConfiguredRepositoryFactory.java b/maven-repository-core/src/main/java/org/apache/maven/repository/configuration/DefaultConfiguredRepositoryFactory.java index f69cc2aa0..7442242ff 100644 --- a/maven-repository-core/src/main/java/org/apache/maven/repository/configuration/DefaultConfiguredRepositoryFactory.java +++ b/maven-repository-core/src/main/java/org/apache/maven/repository/configuration/DefaultConfiguredRepositoryFactory.java @@ -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 ) diff --git a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/ShowArtifactAction.java b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/ShowArtifactAction.java index f2aff7093..defa8134f 100644 --- a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/ShowArtifactAction.java +++ b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/ShowArtifactAction.java @@ -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;