in src/main/java/org/apache/sling/feature/ArtifactId.java [116:162]
public static ArtifactId fromMvnUrl(final String url) {
if ( url == null || (url.indexOf(':') != -1 && !url.startsWith("mvn:")) ) {
throw new IllegalArgumentException("Invalid mvn url: " + url);
}
// throw if repository url is included
if ( url.indexOf('!') != -1 ) {
throw new IllegalArgumentException("Repository url is not supported for Maven artifacts at the moment.");
}
final String coordinates = url.startsWith("mvn:") ? url.substring(4) : url;
String gId = null;
String aId = null;
String version = null;
String type = null;
String classifier = null;
int part = 0;
String value = coordinates;
while ( value != null ) {
final int pos = value.indexOf('/');
final String current;
if ( pos == -1 ) {
current = value;
value = null;
} else {
if ( pos == 0 ) {
current = null;
} else {
current = value.substring(0, pos);
}
value = value.substring(pos + 1);
}
if ( current != null ) {
if ( part == 0 ) {
gId = current;
} else if ( part == 1 ) {
aId = current;
} else if ( part == 2 ) {
version = current;
} else if ( part == 3 ) {
type = current;
} else if ( part == 4 ) {
classifier = current;
}
}
part++;
}
return new ArtifactId(gId, aId, version, classifier, type);
}