Skip to main content

Tasks

As an administrator, you may schedule and execute maintenance tasks to automate repository management. Users with the nexus-tasks privilege may access this configuration.

View Tasks

The tasks table shows the following columns:

  • Name

    A user-defined name for the task to identify it in the user interface and log files.

  • Type

    The list of available task types is documented in more detail below.

  • Status

    Displays when a task is disabled, waiting for its next run, running, or the progress of the current run.

  • Schedule

    Displays when the task is configured to run.

  • Next run

    The date and time of the next execution based on the schedule.

  • Last run and Last result

    The result of the last execution.

Configure Tasks

Add new tasks by selecting Create task or edit the existing tasks. Custom fields are displayed for the task depending on the task type.

When creating or updating a scheduled task, configure the following default properties:

  • Task enabled

    Enable or disable the task.

  • Notification Email

    Configure a notification email for the task execution.

  • Notification Condition

    Notifications may be sent on Failure or on either Success or Failure.

  • Task frequency

    Configure the schedule for the task executions.

    Manual, Once, Hourly, Daily, Weekly, Monthly, and Advanced 

    Advanced (provide a CRON expression) follows the UNIX-style CRON syntax

The characters are not case-sensitive. "LW" may be combined for the "last weekday of the month".
[seconds] [minutes] [hours] [day-of-month] [month] [day-of-week] [year]

* - any value; * in the minute field triggers every minute
? - allowed for the day-of-month and day-of-week fields for no specific value
- - to specify a range such as 10-12 for every hour in the range
, - to specify one than one value such as [MON,WED,FRI] in the day-of-week
/ - specify a start value and increment such as "0/15" for every 15 seconds
L - short-hand for the last value in a named range; common in the last day of the week or month
W - for a specific weekday of the month adjusted for the nearest weekday
# - specify "the nth" named day of the month; "6#3" for the third Friday(6) of the month

EXAMPLES
0 0 12 * * ?              ||  12pm (noon)
0 15 10 ? * *             ||  10:15am
0  * 14 * * ?             ||  Every minute between 2-3pm
0 0/5 14 * * ?            ||  Every 5 minutes between 2-3pm
0 0/5 14,18 * * ?         ||  Every 5 minutes between 2-3pm and 6-7pm
0 0-5 14 * * ?            ||  Every minute starting at 2pm and ending at 2:05pm, every day
0 10,44 14 ? 3 WED        ||  2:10pm and at 2:44pm every Wednesday in the month of March
0 15 10 ? * MON-FRI       ||  10:15am every Monday through Friday
0 15 10 15 * ?            ||  10:15am on the 15th day of the month
0 15 10 L * ?             ||  10:15am on the last day of the month
0 15 10 ? * 6L            ||  10:15am on the last Friday of every month
0 15 10 ? * 6#3           ||  10:15am on the third Friday of the month

Task Logs

The output of every task run go to a separate log file that is configured to be removed after 30 days. These task logs are stored in the following task directory:

$data-dir/log/tasks

The file name of each task log is the task type followed by the date and time the task started. For example:

repository-maven.purge-unused-snapshots-20170618153235.log

The output of the task goes to the nexus.log and the specific task log. Some tasks only go to the nexus.log.

For long-running tasks, progress such as the number of items is logged to the nexus.log every 10 minutes.

Types of Tasks

Tasks are prefixed to fall into the following category types:

  • Admin

    Tasks that include regular maintenance such as backing up the database and cleaning up artifacts through cleanup policies. These tasks are often scheduled to run regularly.

  • Formats

    Format specific tasks are typically to repair metadata and indexes. Some task are used for format specific cleanup tasks which are scheduled regularly.

  • Repair

    Tasks with the "Repair" prefix are only intended to be run manually when encountering specific issues with your system.

    Only run these tasks at the advice of a Sonatype staff member.

  • Repository

    These tasks provide specific functionality such as import/export but include replication and some management tasks. These tasks may be scheduled depending on your use case. Here are some outliers:

    Admin - Change repository blob store
    Admin - Remove a member from a blob store group
    Admin - Log database table record counts
  • Statistics

    These tasks are for updating useful metrics available in the Repository user interface.

Task Name / ID

Scheduled

Description

Admin - Backup H2 Database

h2.backup.task

Yes

Performs a full backup of the underlying config, security, and component databases when using the embedded H2 database. The task adds a timestamp to the backup files in the backup data location.

Choose a location for the backup data for this task. Schedule the task to run as required by your maintenance policy. This task does not back up the contents of the blob stores, only the database.

Admin - Export databases for backup

db.backup

Yes

Performs a backup of the internal legacy OrientDB database and it's underlying config, security, and component databases. Choose a safe location for the backed up data. The task adds a timestamp to the backup files in the backup data location.

This task does not back up the repository content and temporarily puts the repository into a read-only state

Admin - Cleanup repositories using their associated policies

repository.cleanup

Yes

Deletes components based on your cleanup policies. The task is automatically created on server restart and is scheduled to run daily at 1 am server time. You may disable or reschedule the task.

See Cleanup Policies for more information.

Admin - Cleanup Tags

tags.cleanup

Yes

Remove tags and associated components based on your maintenance criteria.

See Tagging for details.

Pro Feature

Admin - Cleanup unused asset blobs

assetBlob.cleanup

Yes

This task soft-deletes unused blobs to prevent Nexus Repository from accidentally creating multiple blobs associated with the same asset. Nexus Repository creates one copy of the task for each format to run every 30 minutes. Use the delay minute/hour property to configure the interval before an asset is soft-deleted. This delay avoids soft-delete files that take a significant amount of time to upload to the repository.

nexus.assetBlobCleanupTask.blobCreatedDelayHour=1
nexus.assetBlobCleanupTask.blobCreatedDelayMinute=60

Before version 3.62.0, this task deletes asset records from the related table regardless of the blob created time.

This task requires H2 or PostgreSQL database.

Admin - Compact blob store

blobstore.compact

Yes

When components are deleted they are labeled as soft deleted. This task permanently removed soft-deleted files to recover storage space. This task does not apply to some object stores, which use their managed lifecycles.

See Cleanup Policies for more information.

Admin - Delete orphaned API keys

security.purge-api-keys

Yes

This task deletes unused API keys generated when using user tokens. Key are orphaned when the user account is deleted.

Admin - Log database table record counts

cluster.periodicLogging

Yes

This task logs clustered database record counts for each node. The task is automatically added when clustering is enabled and can be disabled by including an additional property in the nexus.properties file:

nexus.log.cluster.enabled=false

Pro Feature

Admin - Change repository blob store

repository.move

Use to change which blob store a repository stores it's components. This task requires H2 or PostgreSQL database.

See Change repository blob store for more details.

Pro Feature

Admin - Delete blobstore temporary files

blobstore.delete-temp-files

Deletes the temporary files a the blob store's temp directory. Only file blob stores are processed.

Admin - Execute script

script

Privously in Nexus Repository, scripts written in Groovy could executed in the tasks menu. These scripts used the APIs to perform maintenance and other modifications. To reduce security risk, as of version 3.21.2 this task is disabled.

See the documentation for the Script API.

Admin - Export SQL database to script

database.export.script.h2.task

This task only exists in release 3.69.0 and is only necessary for deployments already using an H2 database.

See Upgrade H2 for details.

Admin - Remove a member from a blob store group

blobstore.group.memberRemoval

This task removes a blob store from a group. Each blob within the removed store is written back to the group and then deleted from the removed blob store.

Apt - Rebuild Apt metadata

repository.apt.rebuild.metadata

This task rebuilds the metadata for a chosen Apt-hosted repository.

Docker - Delete incomplete uploads

repository.docker.upload-purge

Yes

This task cleans up orphaned files that may exist in temporary storage as a result of a restart or incomplete/interrupted uploads.

The Age in Hours parameter allows you to configure the minimum age of incomplete uploads to be deleted.

Docker - Delete unused manifests and images

repository.docker.gc

Yes

This task will handle the deletion of content that is no longer referenced, images that are no longer referenced by a tagged manifest, and V1 layers that are no longer referenced by a tagged layer.

Helm - Rebuild Helm metadata

repository.helm.rebuild.metadata

Rebuilds the metadata for a chosen Helm-hosted repository.

Maven - Delete SNAPSHOT

repository.maven.remove-snapshots

Yes

Deletes SNAPSHOT components from a Maven repository based on a configured number of SNAPSHOTs, age, and release version.

See Maven SNAPSHOT Tasks for information.

Maven - Delete unused SNAPSHOT

repository.maven.purge-unused-snapshots

Yes

This task has been replaced with the Cleanup Policies feature.

Deletes SNAPSHOT components from a Maven repository based on the number of days it has been since the component was last requested.

See Maven SNAPSHOT Tasks for information.

Maven - Publish Maven Indexer files

repository.maven.publish-dotindex

The task publishes the indexer files for all or a specific Maven repository.

Maven - Unpublish Maven Indexer files

repository.maven.unpublish-dotindex

This task is the counterpart to the task Maven - Publish Maven Indexer files and can remove the indexer files.

Repair - Rebuild Maven repository metadata (maven-metadata.xml)

repository.maven.rebuild-metadata

Rebuilds maven-metadata.xml files while validating checksums (.md5/.sha1) in the maven-hosted repository. The parameters filter the components that are repaired.

The maven-metadata.xml files are maintained by the deploying clients. Only run manually to repair a corrupted repository.

PyPI - Delete index Asset MD5 Metadata

repository.pypi.rebuild-metadata

Deletes index assets with MD5 checksums on their links from PyPI repositories. Only removes the index and not the checksum.

PyPI - Delete legacy proxy assets

repository.pypi.delete-legacy-proxy-assets

This task deletes old assets that were previously duplicated due to a code-path change.

PyPI - Generate Missing SHA256 Checksums

repository.pypi.generate-missing-sha256-checksums

Generate sha256 checksums when missing from PyPI metadata.

Repair - Rebuild repository browse

create.browse.nodes

Rebuild the tree browsing data from the database.

Repair - Rebuild repository search

repository.rebuild-index

With support for hosted and proxy repositories, this task rebuilds the search index. It inspects actual components and assets found in the selected repository and thus reflects the true content for supporting search and browse actions.

Canceling this task results in a partially rebuilt search index.

Repair - Recalculate blob store storage

blobstore.metrics.reconcile

This is a slow-running task used to fix incorrect blob storage sizes that should be used with care.

See recalculate blob storage performance testing for details.

Repair - Reconcile component database from blob store

blobstore.rebuildComponentDB

Do not use this task during normal operation of the server.

Use this task to recover lost component metadata from a blob store when restoring content from backup and the database and blob storage are out of sync.

See the topic Reconcile Component Database task below.

Repair - Reconcile date metadata from blob store

rebuild.asset.uploadMetadata

Do not run this task except when Nexus Repository version 3.2.1 OR earlier was used and has been upgraded. This task was used to update files when they were missing the creation date.

Repair - Reconcile npm /-/v1/searchmetadata

repository.npm.reindex

Extracts the search metadata from npm packages in npm-hosted repositories to support the 'v1' search endpoint that replaced the 'all' endpoint.

Repair - Rebuild npm metadata

repository.npm.rebuild-metadata

Rebuilds the metadata for an npm-hosted repository. Configure the task to rebuild metadata for all packages or a specified package. This task may be used to repair when the npm metadata has been corrupted.

Repair - Rebuild Yum repository metadata (repodata)

repository.yum.rebuild.metadata

Rebuilds the metadata for a Yum-hosted repository. This task runs automatically after an RPM is uploaded, deleted, or redeployed. The default wait time is 60 seconds.

Replication - Backfill blob store attributes with component metadata

replication.blobattributesbackfill

Adds missing metadata to files in the blob store for replication. Wait until this task finishes before configuring a replication connection.

Pro Feature

Repository - Delete unused components

repository.purge-unused

Use to soft-delete components not requested in the configured number of days from proxy repositories.

This task is replaced by the Cleanup Policies.

Repository - Import external files

repository.import

Use to import external content into a repository.

See Repository Import for details.

Pro Feature

Repository - Export assets

repository.export

Use to export content from a repository.

See Repository Export for details.

Pro Feature

Rubygems - Generate SHA256 Checksums

repository.rubygems.generate-sha256-checksums

Generate sha256 checksums when missing from RubyGem metadata.

Repair - Rebuild Rubygems versions file

repository.ruby.rebuild.versions

Rebuild the versions file in hosted RubyGems repositories. Only run manually to repair a corrupted repository.

Statistics - Recalculate vulnerability statistics

repository.vulnerability.statistics

Yes

Provides the Log4j Visualizer with request log data. This task deletes the existing data that the visualizer is using and re-processes the logs.

See Log4j Visualizer for more details.

Reconcile Component Database task

This task is used to recover lost component metadata from a blob store when restoring content from backup and the database and blob storage are out of sync. The task searches the blob store for files missing metadata and updates the database with the metadata included in the blob store.

You can configure the task to only reconcile blobs created in the last specified number of days. This can drastically reduce your recovery time. For file blob stores, do not set this number to anything over 90 days. This is the maximum that Sonatype Nexus Repository can recover for file blob stores.

Currently, this task only recovers metadata for:

Apt, Docker, Go, Helm, Maven, npm, NuGet, p2, PyPI,R, Raw, RubyGems, Yum

Run the following tasks once this task is completed. Running these tasks before the restore is complete will cause errors in search and browse results.

Repair - Rebuild repository browse
Repair - Rebuild repository search

# when using npm
Repair - Reconcile npm /-/v1/searchmetadata

# when using Yum
Repair - Rebuild Yum repository metadata (repodata)