Visit my.sonatype.com for documentation on Nexus Repository version 2.
In general, it is OK to directly add/remove artifacts from a repository's local storage directory on disk.
There are a few things to be aware of when doing this:
- Adding and removing artifacts from local storage may leave maven-metadata.xml files in an inconsistent state.
- Changes made directly to local storage will not be reflected in search indexes.
- If you are running Nexus Repository 2.4 or later, the prefix files used by automatic routing may need to be updated.
To do this through the UI right click on the repository and select "rebuild metadata", followed by "repair indexes". The automatic routing can be updated by restarting the server.
These actions can also be scripted via the Nexus Repository 2 REST API. Here's how to do this using curl:
curl -v -u userID:password -X DELETE http://localhost:8081/nexus/service/local/repositories/<repo-id>/routing
curl -v -u userID:password -X DELETE http://localhost:8081/nexus/service/local/metadata/repositories/<repo-id>/content/path/to/folder/
curl -v -u userID:password -X DELETE http://localhost:8081/nexus/service/local/data_index/repositories/<repo-id>/content
Note: Substitute "<repo-id>" in the commands above with the repository ID of the repository you want the commands to be run against, as in "releases".
Note: It is not possible to trigger content path-specific search index ( data_index ) rebuild