Repository Management with Nexus
B.3. Migrating an Archiva Managed Repository

B.3. Migrating an Archiva Managed Repository

Archiva Managed Repositories are the equivalent of Nexus Hosted repositories. To migrate a Managed Repository from Archiva to Nexus, all you need to do is:

  • Create a New Hosted Repository in Nexus
  • Copy the Contents of the Archiva Managed Repository to the Storage Directory of the newly-created Nexus Hosted Repository
  • Rebuild the Index for the New Nexus Hosted Repository

The following example will walk through the process of migrating the Archiva repository named "internal" to a new Nexus Hosted repository named "internal". To view your managed repositories in Archiva, login to Archiva as an administrative user and click on the "Repositories" link in the left-hand navigation menu. Clicking on "Repositories" will list all of your Archiva Managed repositories as shown in Figure B.1, “Archiva Managed Repositories”.

figs/web/archiva-managed-repositories.png

Figure B.1. Archiva Managed Repositories


To migrate this Managed repository to a Nexus Hosted repository, you will need to find the directory in which Archiva stores all of the repository artifacts. to do this, click on the Edit link listed next to the name of the repository you want to migrate as shown in Figure B.1, “Archiva Managed Repositories”. Click on Edit should load the form shown in Figure B.2, “Editing an Archiva Managed Repository”.

figs/web/archiva-managed-repo-edit.png

Figure B.2. Editing an Archiva Managed Repository


Take note of the file path for Directory. The file path shown in Figure B.2, “Editing an Archiva Managed Repository” is ./data/repositories/internal. If Archiva is installed in /usr/local/archiva-1.2.1, this would correspond to the directory /usr/local/archiva-1.2.1/data/repositories/internal. You will use this path later in this section to copy the contents of your old Archiva Managed Repository to your new Nexus Hosted Repository.

Next, create a new Nexus repository with the same identifier and Name as the old Archiva Managed Repository. To do this, log into Nexus as an administrative user, click on Repositories in the left-hand Nexus navigation menu, and then click on the Add drop-down as shown in Figure B.3, “Creating a Nexus Hosted Repository”. Select "Hosted Repository" and then fill out the Repository ID and Repository Name to match the name of the old Archiva repository. If you are migrating a Snapshot repository, select a Repository Policy of Snapshot, and if you are migrating a Release repository select a Snapshot Policy of Release.

figs/web/archiva-new-nexus-hosted.png

Figure B.3. Creating a Nexus Hosted Repository


Now, you’ll need to copy the Archiva repository to the Nexus repository. You can do this, by copying the contents of the Archiva repository directory to the Nexus repository storage directory. If we assume that Archiva is install in /usr/local/archiva-1.2.1, Nexus is install in /usr/local/nexus-1.3.6, and the Sonatype Work directory is /usr/local/sonatype-work. You can copy the contents of the Archiva managed repository to the new Nexus hosted repository by executing the following command:

$ cp -r /usr/local/archiva-1.2.1/data/repositories/internal/* \
/usr/local/sonatype-work/nexus/storage/internal/

If you are migrating to a Nexus instance which is on a different server, you can simply create an archive of the /usr/local/archiva-1.2.1/data/repositories/internal directory, copy it to the new server, and then decompress your repository archive in the appropriate directory.

Warning

Archiva stores artifacts from proxied remote repositories in the same directory as artifacts in a managed repository. If you have been proxying a remote repository, you might want to remove artifacts that have been proxied from a remote repository. For example, if your organization uses a groupId of org.company for internal project, you can make sure to only copy the artifacts under the corresponding org/company/

Once the contents of the repository have been copied to the Nexus Hosted repository, you must rebuild the repository index as shown in Figure B.4, “Rebuilding the Index of a Nexus Hosted Repository”. Right-clicking on the repository in the list of Nexus repositories will display the context menu shown in the following figure.

figs/web/archiva-nx-hosted-rebuild-idx.png

Figure B.4. Rebuilding the Index of a Nexus Hosted Repository


Once the migration is complete, you will be able to search and browse the contents of your newly migrated Nexus Hosted repository.

Sonatype Promotion Subscribe via RSS