}
private static MavenArtifactProvisionOption convertToMaven(String location) {
String[] p = location.split("/");
if (p.length >= 4 && p[p.length-1].startsWith(p[p.length-3] + "-" + p[p.length-2])) {
MavenArtifactProvisionOption opt = new MavenArtifactProvisionOption();
int artifactIdVersionLength = p[p.length-3].length() + 1 + p[p.length-2].length(); // (artifactId + "-" + version).length
if (p[p.length-1].charAt(artifactIdVersionLength) == '-') {
opt.classifier((p[p.length-1].substring(artifactIdVersionLength + 1, p[p.length-1].lastIndexOf('.'))));
}
StringBuffer sb = new StringBuffer();
for (int j = 0; j < p.length - 3; j++) {
if (j > 0) {
sb.append('.');
}
sb.append(p[j]);
}
opt.groupId(sb.toString());
opt.artifactId(p[p.length-3]);
opt.version(p[p.length-2]);
opt.type(p[p.length-1].substring(p[p.length-1].lastIndexOf('.') + 1));
return opt;
} else {
throw new IllegalArgumentException("Unable to extract maven information from " + location);
}
}