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 ) ); } } }