mirror of https://github.com/apache/archiva.git
PR: MRM-59
Added basic maven 1.x path parsing to the utils git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@380602 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8ba07b9513
commit
c810070fd7
|
@ -57,9 +57,11 @@ public class ArtifactUtils
|
|||
|
||||
Collections.reverse( pathParts );
|
||||
|
||||
Artifact finalResult = null;
|
||||
Artifact artifact = null;
|
||||
if ( pathParts.size() >= 4 )
|
||||
{
|
||||
// maven 2.x path
|
||||
|
||||
// the actual artifact filename.
|
||||
String filename = (String) pathParts.remove( 0 );
|
||||
|
||||
|
@ -162,7 +164,7 @@ public class ArtifactUtils
|
|||
}
|
||||
else
|
||||
{
|
||||
finalResult = result;
|
||||
artifact = result;
|
||||
}
|
||||
}
|
||||
else if ( !remainingFilename.startsWith( version ) )
|
||||
|
@ -178,18 +180,41 @@ public class ArtifactUtils
|
|||
else
|
||||
{
|
||||
classifier = remainingFilename.substring( version.length() + 1 );
|
||||
finalResult = artifactFactory.createArtifactWithClassifier( groupId, artifactId, version,
|
||||
artifact = artifactFactory.createArtifactWithClassifier( groupId, artifactId, version,
|
||||
type, classifier );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
finalResult = result;
|
||||
artifact = result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( pathParts.size() == 3 )
|
||||
{
|
||||
//maven 1.x path
|
||||
|
||||
return finalResult;
|
||||
String filename = (String) pathParts.remove( 0 );
|
||||
|
||||
int idx = filename.lastIndexOf( '-' );
|
||||
if ( idx > 0 )
|
||||
{
|
||||
String version = filename.substring( idx + 1 );
|
||||
|
||||
String artifactId = filename.substring( 0, idx );
|
||||
|
||||
String types = (String) pathParts.remove( 0 );
|
||||
|
||||
// remove the "s" in types
|
||||
String type = types.substring( 0, types.length() -1 );
|
||||
|
||||
String groupId = (String) pathParts.remove( 0 );
|
||||
|
||||
artifact = artifactFactory.createArtifact( groupId, artifactId, version, Artifact.SCOPE_RUNTIME, type );
|
||||
}
|
||||
}
|
||||
|
||||
return artifact;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue