@Override
public Artifact lookup(Transport transport, Group group, UnresolvedArtifact artifact) {
if (!artifact.getVersionPattern().isDynamic()) {
// The version isn't dynamic so it can be 'looked-up' directly
final Version version = Version.fromString(artifact.getVersionPattern().getOriginal());
return new Artifact(artifact.getName(), version, artifact.getExtension(), artifact.getClassifier());
}
try {
Version latest = null;
final URI directory = calculateSearchURI(group, artifact);
for (URI uri : transport.list(directory)) {
final String moduleVersion = lastPathElement(uri.getPath());
final Matcher matcher = VERSION_PATTERN.matcher(moduleVersion);
if (!matcher.matches()) {
// invalid module link
continue;
}
final Version version = Version.fromString(matcher.group(1));
if (version.compareTo(latest) > 0) {
latest = version;
}
}
if (latest == null) {