[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aether-users] How to download an artifact from a Maven repository using aether

Hello All,


I’m new to Eclipse Aether and I wonder if is possible to download artifacts from a remote repository, similar to maven dependency:get (http://maven.apache.org/plugins/maven-dependency-plugin/get-mojo.html); So far I figured how to get the latest version of an artefact from a remote repository and I guess I need to use install to get a copy on the local repository:


Version newestVersion = rangeResult.getHighestVersion();            

Artifact newestArtifact = new DefaultArtifact(artifact.getGroupId(), artifact.getArtifactId(), artifact.getClassifier(), artifact.getExtension(), newestVersion.toString());

Artifact pomArtifact = new SubArtifact(newestArtifact, "", "pom");

InstallRequest ins = new InstallRequest();


system.install(session, ins);


But it seems than I’m missing some glue to tell my client to fetch it from the remote repository:


INFO: Installing XXX:YYY.jar:jar:ZZZZ-PRODUCTION to C:\projects\.m2 (enhanced)

INFO: Installed XXX:YYY.jar:jar:ZZZZ-PRODUCTION to C:\projects\.m2 (enhanced)

Exception in thread "main" org.sonatype.aether.installation.InstallationException: Failed to install artifact XXX:YYY.jar:jar:ZZZZ-PRODUCTION: null

      at org.sonatype.aether.impl.internal.DefaultInstaller.install(DefaultInstaller.java:279)

      at org.sonatype.aether.impl.internal.DefaultInstaller.install(DefaultInstaller.java:201)

      at org.sonatype.aether.impl.internal.DefaultInstaller.install(DefaultInstaller.java:158)

      at org.sonatype.aether.impl.internal.DefaultRepositorySystem.install(DefaultRepositorySystem.java:436)


Is this something that Aether can do or should I look to the Maven API directly? If so, does anybody know where to look?


Thanks in advance,





This e-mail may contain information that is confidential, privileged or otherwise protected from disclosure. If you are not an intended recipient of this e-mail, do not duplicate or redistribute it by any means. Please delete it and any attachments and notify the sender that you have received it in error. Unless specifically indicated, this e-mail is not an offer to buy or sell or a solicitation to buy or sell any securities, investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Barclays. Any views or opinions presented are solely those of the author and do not necessarily represent those of Barclays. This e-mail is subject to terms available at the following link: www.barcap.com/emaildisclaimer. By messaging with Barclays you consent to the foregoing.  Barclays Capital is the investment banking division of Barclays Bank PLC, a company registered in England (number 1026167) with its registered office at 1 Churchill Place, London, E14 5HP.  This email may relate to or be sent from other members of the Barclays Group.