[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aether-users] doubts about custom packaging artifacts resolution
|
Hello,
I'm start working in a mojo (maven 3.2.1, aether 0.9.0.M2) where it
needs to traverse project's direct dependency, get its real packaging
type (bundle or other custom archive type) and then generate a proper
file for each found.
The problem is that I'm not being to resolve the bundle artifact or in
local or remote repositories.
at maven central [1] we can see its packaging is "bundle". I'm trying to
resolve it using the code below, but with no success.
Could someone point me to right direction?
thanks in advance.
Cristiano
code:
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.DefaultArtifact;
import org.apache.maven.artifact.handler.ArtifactHandler;
import org.apache.maven.artifact.handler.DefaultArtifactHandler;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
ArtifactHandler bundleArtifactHandler = new
DefaultArtifactHandler("bundle");
Artifact nartifact = new
DefaultArtifact("org.apache.felix", "org.apache.felix.bundlerepository",
"1.6.6", "compile", "bundle", "", bundleArtifactHandler);
getLog().debug("Resolving artifact " + artifact);
ArtifactResolutionRequest request = new
ArtifactResolutionRequest()
.setArtifact(nartifact)
.setRemoteRepositories(remoteRepositories)
.setLocalRepository(localArtifactRepository);
ArtifactResolutionResult resolutionResult = repositorySystem
.resolve(request);
if (resolutionResult.hasExceptions()) {
throw new MojoExecutionException("Could not resolve
artifact: "
+ artifact,
resolutionResult.getExceptions().get(0));
}
[1] -
http://search.maven.org/#artifactdetails|org.apache.felix|org.apache.felix.bundlerepository|1.6.6|bundle