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

By | January 30, 2018

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

Сomments аrchive