I need a bash script which download latest version of the war (either snapshot or release ) file nexus repository in tomcat

Please find me script. Need experts help

server="http://localhost:8081/nexus/content/repositories"
repo="snapshots"
name="org/continuous/Integration"
artifact="Continuous-Integration"
path=$server/$repo/$name/$artifact
mvnMetadata=$(curl -s "$path/maven-metadata.xml")

Please find the nexus repository Image:

enter image description here

2

There are 2 best solutions below

0
On

You can use the information available here Using the Nexus rest API to get latest artifact version for given groupid/artifactId to construct the API call to do this. Shouldn't be very hard to piece the rest of the commands together from here (using curl or wget to do the download, for example).

0
On

last snapshot was downloaded with the help of Nexus rest API

wget --content-disposition "http://localhost:8080/nexus/service/local/artifact/maven/redirect?r=snapshots&g=org.continuous.Integration&a=Continuous-Integration&v=LATEST&e=war"

Thanks DarthHater.It was working with rest API