How to delete artifacts with classifier from Nexus using REST API?

21,492

To delete an specific artifact, use this command:

curl --request DELETE --user "login:password" http://myNexus/service/local/repositories/myRepository/content/myGroupId/myArtifactId/myVersion/myArtifactId-myVersion.jar

You need then to ask nexus to rebuild metadata for the gav (otherwise the *.md5 and *.sha1 files will stay on you repository)

curl -v --request DELETE  --user "login:password"  --silent http://nexusHost/service/local/metadata/repositories/myRepository/content
Share:
21,492
Tony Chemit
Author by

Tony Chemit

Java developer, loves free softwares and enjoy open sources.

Updated on July 28, 2022

Comments

  • Tony Chemit
    Tony Chemit almost 2 years

    I know how to delete a whole GAV using this command :

    curl --request DELETE --user "login:password" http://myNexus/service/local/repositories/myRepository/content/myGroupId/myArtifactId/myVersion

    It works like a charm.

    Now I need to just delete an artifact with a classifier, I could not find or read a solution for this.

    I wonder if there is a way to delete an artifact with a classifier using the Nexus REST API ?

  • neuralmer
    neuralmer almost 7 years
    For larger repositories, it might be useful to narrow the metadata that is rebuilt by specifying the particular section of the repository in the URL. For example: http://nexusHost/service/local/metadata/repositories/myRepos‌​itory/content/com/my‌​Company/myProduct/ar‌​tifactName.