in indexer-core/src/main/java/org/apache/maven/index/artifact/M2GavCalculator.java [129:174]
private Gav getReleaseGav(
String s,
int vEndPos,
String groupId,
String artifactId,
String version,
String fileName,
boolean checksum,
boolean signature,
Gav.HashType checksumType,
Gav.SignatureType signatureType) {
if (!fileName.startsWith(artifactId + "-" + version + ".")
&& !fileName.startsWith(artifactId + "-" + version + "-")) {
// The path does not represents an artifact (filename does not match artifactId-version)!
return null;
}
int nTailPos = vEndPos + artifactId.length() + version.length() + 2;
String tail = s.substring(nTailPos);
int nExtPos = tail.indexOf('.');
if (nExtPos == -1) {
// NX-563: not allowing extensionless paths to be interpreted as artifact
return null;
}
String ext = tail.substring(nExtPos + 1);
String classifier = tail.charAt(0) == '-' ? tail.substring(1, nExtPos) : null;
return new Gav(
groupId,
artifactId,
version,
classifier,
ext,
null,
null,
fileName,
checksum,
checksumType,
signature,
signatureType);
}