Visit my.sonatype.com for documentation on Nexus Repository version 2.
It isn't possible to come up with a set of scheduled tasks that is correct for everyone. How often you will need to run the various tasks is heavily dependent on how constrained your disk space is, how much traffic your Nexus Repository 2 instance receives, and what sort of policies your organization has in place for retaining binary artifacts. That said, see below for information about what the various tasks do, and general recommendations for how often you should run them.
Consult our dedicated article discussing indexing tasks.
General Maintenance Tasks
These tasks are used to control how much disk space Nexus Repository 2 consumes, to optimize performance, and to back up critical files.
- Backup all Nexus Configuration Files (pro only) - This Nexus Professional plugin creates archives of the Nexus configuration data, so that you can recover if you make a mistake while administering Nexus.
- Empty Trash - Most files deleted in Nexus Repository (either automatically or from the UI) are moved to a trash directory. Run this task periodically to recover disk space.
- Evict Unused Proxied Items from Repository Caches - This task removes files from proxy repositories that have not been accessed in the specified number of days. This is useful for controlling disk space, particularly in snapshot proxy repositories.
- Purge Nexus Timeline - The Nexus "timeline" is the system feed. Schedule this task to remove old events from the feed so that disk usage doesn't get too large.
- Remove Snapshots from Repository - Remove old snapshots from hosted repositories. Usually keeping the last couple of snapshots is all that is needed, and checking "remove if released" is also a good idea.
- Remove Unused Snapshots From Repository - Remove snapshots which haven't been downloaded in the specified number of days. Useful for cleaning up old snapshots which do not have a corresponding release GAV. Deleted snapshots are moved to the trash directory so they can be recovered if necessary.
- Remove Releases From Repository - Prunes old releases out of repositories (use this with caution)
- Purge Orphaned API Keys (pro) - Used to remove old user tokens and NuGet API keys which are no longer associated with a Nexus user. User tokens and API keys become orphaned after a user or administrator resets them.
- Drop Inactive Staging Repositories - Remove staging repositories which have not seen any activity (open/close/promote) in the specified number of days. Useful for clearing out forgotten staging repositories.
Back up configuration files daily. Empty trash and purge snapshots daily (the exact number of days to keep and number of snapshots is up to you).
Purge the timeline weekly, keeping 30 days of records is usually sufficient, but this is up to you.
Schedule the "evict unused proxied items" task if you need to reclaim space. This can run weekly, and if something hasn't been accessed for 120 days it is a good candidate to be cleared.
Purge Orphaned API Keys - If you are using either the User Token or NuGet features then run this task weekly.
You should schedule a snapshot remover. How often you should run it and how long it keeps snapshots will vary depending on your build setup. If you're unsure, a good starting point is:
- Repositories: All Repositories
- Snapshot retention (days): 30
- Minimum snapshot count: 3
- Remove if released: yes
- Grace period after release (days): 7
- Delete immediately: yes
The above is conservative, if disk space is an issue the minimum snapshot count and snapshot retention days can be reduced. Also note that not all of the above options are available on older versions of Nexus.
* Download NuGet Feed - Check the remote RSS feed for NuGet proxy repositories for updates
* Rebuild NuGet Feed - Rebuild the entire NuGet RSS feed for a NuGet repository.
If you have NuGet proxy repositories run a "Download NuGet Feed" task daily
P2 (Eclipse Update Site) Tasks
- Mirror Eclipse Update Site - If you have proxies of old style (pre Ecilpse 3.4) update sites you will need to schedule this task. Note that these proxy repositories have a provider type of "P2 Update Site", not "P2".
If you have "p2 update site" proxy repositories run this once a day. This task is not needed for new style "p2" proxy repositories.
These tasks do not need to be run regularly, they are intended to be used to recover from situations where direct manipulation of repository storage on disk has occurred (not through Nexus)
- Expire Repository Caches - Poxy repositories cache information about what is available on their remotes in order to improve performance. This task clears these caches.
- Rebuild Maven Metadata Files - Rebuilds maven-metadata.xml tasks from information on disk. This should only be run if you have a workflow that involves direct manipulation of maven repository storage on disk.
- Yum: Generate Metadata - Used to regenerate yum metadata. Again, this should not be needed during regular operation, but if you have recently enabled yum metadata creation on a hosted repository you will need to schedule this to populate the metadata.
In general you do not need to schedule these tasks to run regularly.