From be4381e9b49b5a454326fbe5d002034c96352416 Mon Sep 17 00:00:00 2001 From: Brett Porter Date: Mon, 9 Jan 2006 03:32:02 +0000 Subject: [PATCH] add repository base to artifact files, they are expected to be absolute git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@367176 13f79535-47bb-0310-9956-ffa450edef68 --- .../discovery/DefaultArtifactDiscoverer.java | 11 ++++++----- .../discovery/LegacyArtifactDiscoverer.java | 6 +++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/DefaultArtifactDiscoverer.java b/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/DefaultArtifactDiscoverer.java index fdc9b7643..ffb8cdcd4 100644 --- a/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/DefaultArtifactDiscoverer.java +++ b/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/DefaultArtifactDiscoverer.java @@ -31,14 +31,15 @@ import java.util.StringTokenizer; * * @author John Casey * @author Brett Porter - * * @plexus.component role="org.apache.maven.repository.discovery.ArtifactDiscoverer" role-hint="default" instantiation-strategy="per-lookup" */ public class DefaultArtifactDiscoverer extends AbstractArtifactDiscoverer implements ArtifactDiscoverer { - /** @plexus.requirement */ + /** + * @plexus.requirement + */ private ArtifactFactory artifactFactory; public List discoverArtifacts( File repositoryBase, String blacklistedPatterns, boolean includeSnapshots ) @@ -51,7 +52,7 @@ public class DefaultArtifactDiscoverer { String path = artifactPaths[i]; - Artifact artifact = buildArtifact( path ); + Artifact artifact = buildArtifact( repositoryBase, path ); if ( artifact != null ) { @@ -65,7 +66,7 @@ public class DefaultArtifactDiscoverer return artifacts; } - private Artifact buildArtifact( String path ) + private Artifact buildArtifact( File repositoryBase, String path ) { List pathParts = new ArrayList(); StringTokenizer st = new StringTokenizer( path, "/\\" ); @@ -215,7 +216,7 @@ public class DefaultArtifactDiscoverer if ( finalResult != null ) { - finalResult.setFile( new File( path ) ); + finalResult.setFile( new File( repositoryBase, path ) ); } return finalResult; diff --git a/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/LegacyArtifactDiscoverer.java b/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/LegacyArtifactDiscoverer.java index 25929bf08..40b1d22a0 100644 --- a/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/LegacyArtifactDiscoverer.java +++ b/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/LegacyArtifactDiscoverer.java @@ -53,7 +53,7 @@ public class LegacyArtifactDiscoverer { String path = artifactPaths[i]; - Artifact artifact = buildArtifact( path ); + Artifact artifact = buildArtifact( repositoryBase, path ); if ( artifact != null ) { if ( includeSnapshots || !artifact.isSnapshot() ) @@ -69,7 +69,7 @@ public class LegacyArtifactDiscoverer /** * @noinspection CollectionDeclaredAsConcreteClass */ - private Artifact buildArtifact( String path ) + private Artifact buildArtifact( File repositoryBase, String path ) { StringTokenizer tokens = new StringTokenizer( path, "/\\" ); @@ -326,7 +326,7 @@ public class LegacyArtifactDiscoverer Artifact.SCOPE_RUNTIME, type ); } - result.setFile( new File( path ) ); + result.setFile( new File( repositoryBase, path ) ); } } }