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
This commit is contained in:
Brett Porter 2006-01-09 03:32:02 +00:00
parent d23ce4c8e0
commit be4381e9b4
2 changed files with 9 additions and 8 deletions

View File

@ -31,14 +31,15 @@ import java.util.StringTokenizer;
* *
* @author John Casey * @author John Casey
* @author Brett Porter * @author Brett Porter
*
* @plexus.component role="org.apache.maven.repository.discovery.ArtifactDiscoverer" role-hint="default" instantiation-strategy="per-lookup" * @plexus.component role="org.apache.maven.repository.discovery.ArtifactDiscoverer" role-hint="default" instantiation-strategy="per-lookup"
*/ */
public class DefaultArtifactDiscoverer public class DefaultArtifactDiscoverer
extends AbstractArtifactDiscoverer extends AbstractArtifactDiscoverer
implements ArtifactDiscoverer implements ArtifactDiscoverer
{ {
/** @plexus.requirement */ /**
* @plexus.requirement
*/
private ArtifactFactory artifactFactory; private ArtifactFactory artifactFactory;
public List discoverArtifacts( File repositoryBase, String blacklistedPatterns, boolean includeSnapshots ) public List discoverArtifacts( File repositoryBase, String blacklistedPatterns, boolean includeSnapshots )
@ -51,7 +52,7 @@ public class DefaultArtifactDiscoverer
{ {
String path = artifactPaths[i]; String path = artifactPaths[i];
Artifact artifact = buildArtifact( path ); Artifact artifact = buildArtifact( repositoryBase, path );
if ( artifact != null ) if ( artifact != null )
{ {
@ -65,7 +66,7 @@ public class DefaultArtifactDiscoverer
return artifacts; return artifacts;
} }
private Artifact buildArtifact( String path ) private Artifact buildArtifact( File repositoryBase, String path )
{ {
List pathParts = new ArrayList(); List pathParts = new ArrayList();
StringTokenizer st = new StringTokenizer( path, "/\\" ); StringTokenizer st = new StringTokenizer( path, "/\\" );
@ -215,7 +216,7 @@ public class DefaultArtifactDiscoverer
if ( finalResult != null ) if ( finalResult != null )
{ {
finalResult.setFile( new File( path ) ); finalResult.setFile( new File( repositoryBase, path ) );
} }
return finalResult; return finalResult;

View File

@ -53,7 +53,7 @@ public class LegacyArtifactDiscoverer
{ {
String path = artifactPaths[i]; String path = artifactPaths[i];
Artifact artifact = buildArtifact( path ); Artifact artifact = buildArtifact( repositoryBase, path );
if ( artifact != null ) if ( artifact != null )
{ {
if ( includeSnapshots || !artifact.isSnapshot() ) if ( includeSnapshots || !artifact.isSnapshot() )
@ -69,7 +69,7 @@ public class LegacyArtifactDiscoverer
/** /**
* @noinspection CollectionDeclaredAsConcreteClass * @noinspection CollectionDeclaredAsConcreteClass
*/ */
private Artifact buildArtifact( String path ) private Artifact buildArtifact( File repositoryBase, String path )
{ {
StringTokenizer tokens = new StringTokenizer( path, "/\\" ); StringTokenizer tokens = new StringTokenizer( path, "/\\" );
@ -326,7 +326,7 @@ public class LegacyArtifactDiscoverer
Artifact.SCOPE_RUNTIME, type ); Artifact.SCOPE_RUNTIME, type );
} }
result.setFile( new File( path ) ); result.setFile( new File( repositoryBase, path ) );
} }
} }
} }