Thursday, 18 June 2015

How to download Artifacts from maven repo


To make deployment automated, there may be need to get the artifacts from maven repo.
Release artifacts can be downloaded since we know the version But how to download the latest snapshot artifacts.

here are few http call to get  rid of such issues.

How to download latest Snapshot artifact from nexus maven repo

If you know the version you can directly get the artifact like this

wget  http://<Your repo name>/service/local/artifact/maven/content?r=snapshots&g=com.&a=app&v=2.0.25-SNAPSHOT&p=war



If you don't know the version you can get the latest snapshot of latest version

wget "http://<Your repo name>/service/local/artifact/maven/content?r=snapshots&g=com&a=appp&v=LATEST&p=war" --content-disposition

Similar way works for Release too

wget "http://repository.sonatype.org/service/local/artifact/maven/content?r=releases&g=com&a=app&v=LATEST" --content-disposition


How to download maven artifacts from Artifactory Repo

wget https://<your-server>/artifactory/snapshots/com/app/2.0.25-SNAPSHOT/app-2.0.25-SNAPSHOT.war

Above will get you the latest snapshot of the specific version.
Similar would work for Release too.