Help Center> CodeArts Artifact> Best Practices> Migrating Maven Components to Self-Hosted Repo in Batches
Updated on 2023-06-15 GMT+08:00

Migrating Maven Components to Self-Hosted Repo in Batches

CodeArts Artifact provides batch migration tool to migrate Maven components from the Nexus server to CloudArtifact. This section describes how to migrate Maven components in batches.

The repositories and components to be migrated are as follows:

Prerequisites

  1. A private Maven repository has been created.
  2. This document is written based on the Python language, and the Nexus server must support Python2.

Obtaining CloudArtifact Address and Configuration File

  1. Obtain the repository address.

    1. Access the Self-Hosted Repo, and choose the target Maven repository in the left pane.
    2. Find the Repository Address. Click to copy the address.

  2. Obtain the configuration file.

    1. In the upper right corner, choose Set Me Up
    2. In the displayed dialog box, click Download Configuration File.

    3. Open the configuration file on the local PC and search for the username and password.

Downloading the Migration Tool to the Server

  1. Return to the Self-Hosted Repo homepage, and choose Download Migration Tool.
  2. Copy the downloaded .zip package to the server.
  3. Log in to the server and go to the directory where the .zip package is stored. Run the following commands to decompress the package and go to the directory generated after the decompression:

    unzip Nexus2DevCloud.zip
    cd Nexus2DevCloud/

Configuring and Running the Migration

  1. Run the following command to start the migration tool script:

    ./NexusToDevcloud.py

    The following configuration page is displayed.

    If Permission denied is displayed, run the following command:

    $ sudo chmod -R 777 ./NexusToDevcloud.py

    or

    $ sudo chmod 755 ./NexusToDevcloud.py

  2. Press i to start the initial configuration.

    Press the letter before each line, enter the server configuration and CloudArtifact configuration, and press q to return to the previous page.

    Configuration Item

    Description

    Nenux Data Directory

    Enter the Nexus data directory on the server.

    After you enter the directory, Nexus URL, Nexus Username, and Nexus Password may be displayed. Enter the values based on the site requirements.

    DevCloud URL

    Enter the address obtained in Obtaining CloudArtifact Address and Configuration File.

    DevCloud Username

    Enter the username obtained in Obtaining CloudArtifact Address and Configuration File.

    DevCloud Password

    Enter the password obtained in Obtaining CloudArtifact Address and Configuration File.

  3. Press r to go to the repository migration configuration page.

    The repository list is displayed. Press the left or right arrow key to turn pages. Enter the repository ID to select or cancel the repository to be migrated. If a green + is displayed next to a repository name, the repository needs to be migrated. After the configuration is complete, press q to return to the previous page.

    You can select only one host repository (that is, the repository ending with maven) for migration at a time.

  4. Press s to save the configuration (save the document as conf.json).

  5. Press v to verify the configuration. If the verification is successful, the following information is displayed:

  6. Press x to run the migration. If the following page is displayed, the migration is complete.

    If the push fails, check whether the following configurations are correct:

    • Check whether the network connection between the server and DevCloud is normal.
    • Check whether the repository path is correct.
    • Check whether the uploaded account and password are correct.

  7. Access CloudArtifact to view the migration result.