How to limit number of deployed snapshots artifacts in Nexus?
Create a scheduled task to purge out old snapshots.
The following links describe the functionality:
- Nexus scheduled tasks
- Managing scheduled tasks - Repository Manager 2
- Types of Tasks and When to Use Them - Repository Manager 3 (Task "Maven - Delete SNAPSHOT")
You can configure the task to always keep a minimum number of artifacts. It's very flexible.
The only "gotcha" in Version 2 of the Repository Manager, is that you'll need to also run a second task, Empty Trash, in order to claim back the disk space. For Version 3 you will need to run Compact blob store to ensure that the deletion will return the disk space. See docs above.
If you have the administrator access in Nexus Then,
Login to Nexus.
Browse to Administration.
Go to scheduled Tasks.
You can add the task : Remove Old Snapshots.
Select task type as Remove Snapshots from repository.
You can define Minimum Snapshot count or Snapshot retention as needed.