final String buildNumber =
XmlUtils.getTextContentOfElement(snapshotMetadata, "versioning/snapshot/buildNumber");
final String localSnapshot =
XmlUtils.getTextContentOfElement(snapshotMetadata, "versioning/snapshot/localCopy");
if (timestamp != null && buildNumber != null) {
return new DownloadableArtifact(
parser.getSnapshotVersion(version, timestamp, buildNumber),
priority,
repositoryURL.getURL(),
parser.getSnapshotPath(version, timestamp, buildNumber),
localSnapshot != null,
configuration.getCertificateCheck()
);
} else {
String lastUpdated = XmlUtils.getTextContentOfElement(snapshotMetadata, "versioning/lastUpdated");
if (lastUpdated != null) {
// last updated should contain in the first 8 chars the date and then the time,
// fact that is not compatible with timeStamp from remote repos which has a "." after date
if (lastUpdated.length() > 8) {
lastUpdated = lastUpdated.substring(0, 8) + "." + lastUpdated.substring(8);
return new DownloadableArtifact(
parser.getSnapshotVersion(version, lastUpdated, "0"),
priority,
repositoryURL.getURL(),
parser.getArtifactPath(version),
localSnapshot != null,
configuration.getCertificateCheck()
);
}
}
}
} catch (IOException ignore) {
// in this case we could not find any metadata so try to get the *-SNAPSHOT file directly
}
return new DownloadableArtifact(
parser.getVersion(),
priority,
repositoryURL.getURL(),
parser.getArtifactPath(),
false, // no local built snapshot