1

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

alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
AMIT
  • 71
  • 8
  • I'm sorry, but what are you trying to accomplish? – sjsam Dec 20 '16 at 04:12
  • I need a script which download the war file from nexus repository in to the tomcat webapps folder. I will use this script with Scalr (CAMP) which execute this script into new cloud instance and code will be deploy – AMIT Dec 20 '16 at 04:19
  • I'm very new to the scripting...writing scripting first time – AMIT Dec 20 '16 at 04:20

2 Answers2

1

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

AMIT
  • 71
  • 8
0

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).

Community
  • 1
  • 1
DarthHater
  • 3,222
  • 25
  • 26