Search code examples
restmavennexussonatype

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


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 ?


Solution

  • 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