I have uploaded the artifact to Sonatype Nexus from command line by using MAVEN/maven/bin/mvn -X -e deploy:deploy-file -Durl=http://maven-nexus.com/nexus/content/repositories/xyz -DrepositoryId=xyz -DgroupId=com.kumar -DartifactId=peshu -Dversion=1.0.12 -Dpackaging=war -Dfile=RIGHT.war
Now I would like to delete this version (1.0.12) from command line so that I can automate this process, what is the command I can use instead of Curl.
You have two options to get rid of artifacts which are not needed any more. First you can configure “cleanup policies”. Another approach is that you might want to set up a task which executes a custom Groovy script which deals with the removal of old artifacts.
If you have modified the configuration of Nexus, that configuration is stored in sonatype-work/. If you've uploaded artifacts to hosted repositories, customized repository metadata, or proxied artifacts from remote repositories, all of that data is going to be stored in sonatype-work/.
Removing Releases. If you decide that you do want to remove old releases Nexus makes this easy. As of version 2.5 there is a new task you can add, "Remove Releases From Repository".
Short anwser:
curl --request DELETE --write "%{http_code} %{url_effective}\\n" --user login:password --output /dev/null --silent http://maven-nexus.com/nexus/content/repositories/xyz/com.kumar/peshu/1.0.12
This will delete the hole GAV from your nexus.
Note:
--write "%{http_code} %{url_effective}\\n
option will return you the http code and the effective url used; idem the --output /dev/null --silent
hide some verbose informations on the output,...Nexus version 2.5 has a Remove Releases From Repository task.
The issue of deleting released artifacts is discussed in detail here:
https://support.sonatype.com/entries/20871791-Can-I-delete-releases-from-Nexus-after-they-have-been-published-
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With