Artifact metaArtifact = artifacts[i];
if (matcher.match(metaArtifact)) {
if (matcher.matchName(artifact, metaArtifact.getName())) {
// we've found a matching artifact, let's provision it
ArtifactDownloadReport metaAdr = ivy.getResolveEngine().download(
metaArtifact, new DownloadOptions());
if (metaAdr.getLocalFile() != null && metaAdr.getLocalFile().exists()) {
return getArtifactPath(metaAdr);
}
}
// keep a reference to the artifact so we could fall back
// to map-if-only-one
nbFound++;
foundArtifact = metaArtifact;
}
}
if (mapIfOnlyOne) {
// we haven't found artifact in the module declaring the artifact and having
// a matching name.
if (nbFound == 1) {
// If there is only 1 found artifact, it is the winner ;-)
ArtifactDownloadReport metaAdr = ivy.getResolveEngine().download(foundArtifact,
new DownloadOptions());
if (metaAdr.getLocalFile() != null && metaAdr.getLocalFile().exists()) {
return new Path(metaAdr.getLocalFile().getAbsolutePath());
}
}
}