Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nexus artifact delete command

Tags:

nexus

sonatype

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.

like image 951
ram chander Avatar asked Aug 07 '15 18:08

ram chander


People also ask

How do I remove an artifact from Nexus?

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.

Where are artifacts stored in Nexus?

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/.

How do I remove Nexus release?

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".


2 Answers

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.
like image 177
Tony Chemit Avatar answered Oct 10 '22 22:10

Tony Chemit


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-

like image 4
Mark O'Connor Avatar answered Oct 10 '22 21:10

Mark O'Connor