[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aether-users] How to download just the POM of an artifact?
|
Andreas Sewe wrote:
what is the right request to just download a POM file from a remote
repository?
I tried issuing a
new ArtifactRequest(new DefaultArtifact(groupId, artifactId, "pom",
version), repos, null);
[...]
but to no avail. If the artifact in question is not of packaging "pom"
the requests yield results whose result.getArtifact().getFile() is null.
There's a ResolveArtifact class among the examples. Tweaking this to
Artifact artifact = new DefaultArtifact(
"org.sonatype.aether:aether-util:pom:1.13" );
RemoteRepository repo = Booter.newCentralRepository();
ArtifactRequest artifactRequest = new ArtifactRequest();
artifactRequest.setArtifact( artifact );
artifactRequest.addRepository( repo );
ArtifactResult artifactResult = system.resolveArtifact( session,
artifactRequest );
artifact = artifactResult.getArtifact();
System.out.println( artifact + " resolved to " + artifact.getFile() );
works for me. So you might want to double-check why exactly your code
didn't work, it's generally the right approach.
(preferably with Sonatype Aether 0.13.1, which I still have to use)?
Out of curiosity, why exactly are you bound to this old version?
Benjamin