Nexus artifact delete command

ram chander picture ram chander · Aug 7, 2015 · Viewed 10.7k times · Source

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.

Answer

Tony Chemit picture Tony Chemit · Dec 6, 2015

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:

  • The --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,...
  • I am not quite sure, but I think you need a user login with admin rights on the Nexus.