In the Nexus 3 Reference about its REST API and scripting it is described how to upload Groovy scripts to Nexus 3 and how to run them. Examples are shown how to create new repositories, such as a Maven repository:
repository.createMavenHosted('private')
However, as simple as it sounds, I did not find any similar method to delete or remove an existing repository. Is that really not possible?
I tried (even though I thought it would not work):
{
"name" : "cleanup",
"type" : "groovy",
"content" : "repository.getRepositoryManager().delete('maven-public');"
}
Source: https://github.com/savoirfairelinux/ansible-nexus3-oss/blob/master/files/groovy/delete_repo.groovy
As it turns out, this piece of code really does work to delete the maven-public repository, if it is available ...