Skip to main content

Repository Export

Note

Only available in Sonatype Nexus Repository Pro. Interested in a free trial? Start here.

The Repository - Export assets task will export all the content from a selected repository into a directory in your server. The content of this export directory can be imported to another Sonatype Nexus Repository instance using the Repository - Import external files task.

Configuration

Note

If you plan to import your exported content to another Sonatype Nexus Repository 3 instance, both the source and target Sonatype Nexus Repository 3 instances must be using the same version. You will not be able to import files from an older or newer Sonatype Nexus Repository 3 version. However, you can import files from the latest Sonatype Nexus Repository 2 version in order to upgrade.

Create a new task of type Repository - Export assets and you will be presented with the configuration options listed below:

Tasks screen

A number of the fields on this form are common to all tasks and described in the main Tasks topic. The export-specific fields are as follows:

Source repository - The repository to export content from. This list will only be populated with repositories of the supported formats (see format list below).

Target directory - The directory to export content into.

Threshold (in days) of unused assets to include - You would usually use this field to export unused assets that you'd like to archive. When set, Sonatype Nexus Repository will only export assets that have not been updated or downloaded in the provided number of days (e.g., set to "30" to export assets that have not been updated or downloaded for 30 days). If left blank or set to "0," the export will include all assets.

Note

Note that Sonatype Nexus Repository will use this threshold to identify and export assets, not components, which can comprise multiple assets. This is different from a cleanup policy, which looks at whether an entire component or any of its parts have been used. See Components, Repositories, and Repository Formats to better understand the difference between components and assets.

If you wish to delete unused assets after exporting them, you will need to identify and use the paths from the export to delete the content from the primary server.

The target directory must be writable by the user running Sonatype Nexus Repository. The export history is stored in the target directory to enable incremental exports.

Usage

Note

Only one import/export task can run at a time. If you attempt to run more than one at a time, the others will be queued to run after the initial one completes.

The task can be configured to run manually or on a schedule fitting your needs. And when the task runs, it generates a .nexus directory inside of the target directory, that contains some metadata we use for future exports, so that content won't be exported multiple times if the task is run more than once. This will allow you to keep exporting content into this directory, and the next time the export task runs, only the newer content will be exported.

As the export is being processed, every single file that is exported will be logged to a task log (a new task log is created each time a task runs), along with any errors that may have occurred. If an error occurs with any particular asset, we will simply log that fact, then continue on exporting the rest of the content.

Supported Formats

Currently, content can be exported from repositories of any format listed below:

Format

Since

Raw

3.24.0

Maven

3.24.0

npm

3.25.0

NuGet

3.25.0

Docker

3.26.0

PyPI

3.26.0

RubyGems

3.26.0

Yum

3.26.0