use of org.eclipse.aether.repository.LocalArtifactResult in project wildfly-swarm by wildfly-swarm.
the class MavenArtifactResolvingHelper method resolve.
@Override
public ArtifactSpec resolve(ArtifactSpec spec) {
if (spec.file == null) {
final DefaultArtifact artifact = new DefaultArtifact(spec.groupId(), spec.artifactId(), spec.classifier(), spec.type(), spec.version());
final LocalArtifactResult localResult = this.session.getLocalRepositoryManager().find(this.session, new LocalArtifactRequest(artifact, this.remoteRepositories, null));
if (localResult.isAvailable()) {
spec.file = localResult.getFile();
} else {
try {
final ArtifactResult result = resolver.resolveArtifact(this.session, new ArtifactRequest(artifact, this.remoteRepositories, null));
if (result.isResolved()) {
spec.file = result.getArtifact().getFile();
}
} catch (ArtifactResolutionException e) {
e.printStackTrace();
}
}
}
return spec.file != null ? spec : null;
}
Aggregations