Skip to content

Instantly share code, notes, and snippets.

@mcbrihk
Created November 4, 2014 16:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mcbrihk/039d5f56ff31bcf27c47 to your computer and use it in GitHub Desktop.
Save mcbrihk/039d5f56ff31bcf27c47 to your computer and use it in GitHub Desktop.
Download the latest snapshot from nexus using wget
Download the latest snapshot from nexus using wget
From Maven 3, support for uniqueVersion is disabled and when you distribute your snapshots by publishing them on nexus you end up with snapshot names ending with timestamps. Suddenly your QA or Integration server scripts start failing if you are getting war file from nexus repository as there is no unique name now.
To get the latest version of snapshot you can use a service available from Nexus as
wget -O my-services.war http://nexus.myorg.net/nexus/service/local/artifact/maven/redirect?r=snapshots\&g=my.company.product.services\&a=my-services\&v=1.0-SNAPSHOT\&p=war
Where
r is the id of the repository
g is the group id
a is the artifact id
v is the version of artifact
p is the packaging type
The argument -O helps in renaming the output file to the name you want so that you have a fixed name you can use in your shell script.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment