Download latest snapshot artifact from Nexus Repository Manager OSS 3.30.0-01 using wget command

I am facing difficulty downloading the latest snapshot version from Nexus Repository Manager OSS 3.30.0-01 using wget command

since the format is maven artefacts snapshots version are appended with
timestamp along with build number.

so how to download the latest snapshot version from multiple version under one snapshot?

currently, I have to specify explicitly specify the version like the below one

wget http://$NEXUS_URL/repository/mfi-snapshots/com/mf/productService/1.0.9-SNAPSHOT/productService-1.0.9-20210329.141405-11.war

where
$NEXUS_URL: is the nexus URL
mfi-snapshots: is the snapshot repo
com.mf: is the group
productService is the artefact
1.0.9 SNAPSHOT the version of the artefact

i tried to use API “/v1/search/assets/download” ( not sure how to use it )
like the below

http://$NEXUS_URL/service/rest/v1/search/assets/download?sort=version&direction=desc&repository=mfi-snapshots&group=com.mf&name=productService

the format of the nexus is attached here with.

You can use the REST API for this:

https://help.sonatype.com/display/NXRM3/Search+API#SearchAPI-DownloadingtheLatestVersionofanAsset

1 Like

Thanks a lot, it helped

We are using Sonatype Nexus Repository ManagerOSS 3.38.0-01 and I’ve tried this. Filtering doesn’t work. I’m getting a different archive with every call to the REST API using

curl -L -X GET "<nexus_url>/service/rest/v1/search/assets/download?sort=version&repository=maven-snapshots&maven.groupId=company.org&maven.artifactId=some.module&maven.extension=zip&maven.classifier=processes" -H "accept: application/json" --output "/mnt/c/TEMP/processes.zip"

I’ve tried the swagger-ui using asset search and found that maven.artifactId arg is ignored when using the version filter.

Found out that quoting the search criteria does the job, e.g.:

maven.artifactId=%22some.module%22