I am facing difficulty downloading the latest snapshot version from Nexus Repository Manager OSS 3.30.0-01 using wget /curl
the problem I am facing is that in nexus there are multiple version of artefacts within the same snapshot version appended with timestamp plus - an incremental number like the below image
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
So is there any way to download the latest version with just mentioning the snapshot version and download the latest ver
$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 "/v1/search/assets/download" API defined in nexus ( not sure how to use it
http://$NEXUS_URL/service/rest/v1/search/assets/download?sort=version&direction=desc&q=war&repository=mfi-snapshots&group=com.mf&name=productService
I followed the steps mentioned in help article on sonatype and I got the solution
curl -L -o productService.war -s -X GET "$NEXUS_HOST/service/rest/v1/search/assets/download?sort=version&repository=$NEXUS_SNAPSHOTS_REPO&maven.groupId=com.mf&maven.artifactId=productService&maven.baseVersion=$SNAPSHOT_VERSION&maven.extension=war" -H "accept: application/json"