How can I retrieve a snapshot if I don't know the exact filename?

A. Nexus Provides a separate REST API to retrieve files when interpreting the maven-metadata.xml is required. The syntax looks like this:

wget "" --content-disposition


  • r = the id of the repository or group to search (Required)
  • g = the groupId of the file (Required)
  • a = the artifactId of the file (Required)
  • v = the version of the file, this may be "LATEST", "RELEASE", a version number like "2.0", or a snapshot version number like "2.0-SNAPSHOT". (Required)
  • c = the classifier of the file (Optional)
  • e = the type or extension of the file (Optional)
  • p = packaging (Nexus will resolve known packaging types to the correct extension). (Optional)

If the version is not a concrete version, then Nexus will look in the maven-metadata.xml in the same way Maven does to resolve the version. The filename will be set in the content-disposition header field, so if you are using wget, be sure to use the --content-disposition flag so the filename is correct.

There is an alternate form of the API that uses redirects to work around the content-disposition setting. This form is shown below:

wget "

Alternative - Use Maven

Alternatively, you can use Maven to retreive a snapshot version. First download it to your local maven repository using the "dependency:get" goal":

mvn dependency:get -DremoteRepositories=http://localhost:8081/repository/maven-public -DartifactId=project -Dversion=1.0.0-SNAPSHOT -Dtransitive=false

Then use the "dependency:copy" goal to move the snapshot from your local repository to wherever you like:

mvn dependency:copy -DoutputDirectory=/some/output/path

Have more questions? Submit a request


  • 0
    Mark Strickland Emery


    I've got a file in a nexus-2.13.0-01 Maven2 hosted repo, several different versions loaded up with mvn as 0.0.9, 0.99.0, 1.0.0, 1.0.5, 2.1.0, 2.2.0, 2.2.9 for testing. I noticed that my Puppet class wasn't getting the right version onto the test client. Capturing the URL and using it with wget I see the problem too. How is "LATEST" calculated server side? 1.0.5 isn't it.

    wget '' -O /tmp/OMGTEST.jpg

    --2016-09-15 10:47:46--

    Connecting to connected.

    HTTP request sent, awaiting response... 307 Temporary Redirect

    Location: [following]

    --2016-09-15 10:47:46--

    Reusing existing connection to

    HTTP request sent, awaiting response... 200 OK

    Length: 104637 (102K) [image/jpeg]

    Saving to: ‘/tmp/OMGTEST.jpg’

    /tmp/OMGTEST.jpg 100%[======================================================================================>] 102.18K --.-KB/s in 0.008s

    2016-09-15 10:47:46 (12.2 MB/s) - ‘/tmp/OMGTEST.jpg’ saved [104637/104637]

    Regards, Mark

  • 0
    Peter Lynch


    The answer is to look in this file:

    1.0.5 will be the first version in the versions list.

    Edited by Peter Lynch
Article is closed for comments.
Powered by Zendesk