Migrating Hosted Repository Data from Nexus to CodeArts Artifact
Migrate hosted repositories from Nexus to CodeArts Artifact using migration tools.
Migration tools work as follows: Read the packages on Nexus to the input stream, and then call the CodeArts Artifact APIs to upload the packages.
Prerequisites
- The runtime environment is JDK 8. Run the java -version command to verify your environment. For details about how to install JDK, see https://www.java.com/en/.
- The PC running the migration tool is connected to both Nexus and CodeArts Artifact. That is, the PC can access the network addresses of Nexus and CodeArts Artifact. You can use either of the following methods to verify the connection:
- Run the following commands:
telnet Nexus domain name or IP address: Port telnet Repository address of CodeArts Artifact (For details about how to obtain the repository address, see 1.)
- Open a browser and enter the Nexus domain name or IP address:port and the CodeArts Artifact repository address (for details about how to obtain the repository address, see 1).
- Run the following commands:
Step 1: Identifying the Original Repository to Migrate
Check the repository and package types of the repository to be migrated. If the repository is hosted, perform the operations in this section.
Step 2: Creating a Local Repository in Self-Hosted Repos
Create a repository based on the repository type in Confirming Repository and Package Types. The following describes how to create a local Maven repository.
- Use your Huawei Cloud account to access self-hosted repos.
- On the Self-hosted Repos page, click Create Repository in the upper-right corner.
- Set Repository Type to Local Repo, Package Type to Maven, and Project to an existing project, and click OK. The created Maven repository is displayed in the Repo View.
- Click Create Repository in the upper-right corner to create another repository as required.

Step 3: Obtaining Repository URL and Configuration File
- Obtain the repository URL.
- Find the repository created in Step 2: Creating a Local Repository in Self-Hosted Repos and click Repo View.
- Click the repository name. The Repository Path is displayed on the General tab. Click
to copy the repository URL.

- Obtain the configuration file.
- Click Tutorial on the right of the page.
- In the Tutorial dialog box, click Download Configuration File to download the settings.xml file to the localhost.

- Open the settings.xml file on the localhost and find the username and password in the red box shown in the following figure.

Step 4: Configuring Migration Tools for Local Repository
- Use your Huawei Cloud account to access self-hosted repos.
- In the left pane, click the target Maven repository name.
- Click
in the upper-right corner of the page, and select Download Migration Tool to download the tool package (migration tool name: relocation-jfrog-20251016.1.jar; configuration file: application-nexus.yaml) to the localhost. - The following is an example of the application-nexus.yaml file. The example contains only mandatory parameters. You can directly search for the parameter name in the file. These parameters are under relocation.
Table 1 Key configurations in application.yaml Parameter
Example Value
Description
name
nexus-to-artifact
Name of the migration task (only for display).
package_type
maven
Migration package type: maven, npm, PyPI, and Go
NOTICE:Maven repositories are classified into Release and Snapshot repositories. If the original repositories are mixed, you need to migrate the original repositories twice to migrate Release and Snapshot repositories to different Maven repositories.
migrate_type
nexus3
Migration type. The value can be nexus3 or nexus2, depending on the Nexus version.
save_temp_dir
D:/tmp/xxx/
Cache path, which is mandatory for migrating Maven. The path ends with a slash (/). The last uploaded snapshot version of the Maven is stored in this path.
domain
http://{ip}:{port}
Domain name of the original repository. The path must not end with a slash (/).
repo
test_maven
Original repository name, which is the repository name on Nexus. You can obtain the name of the repository to be migrated from the NAME field on the Nexus page.
user_name
username
Original repository username.
password
password
Original repository password.
target_domain
https://{domain}/artgalaxy
https://{domain}/artgalaxy/api/npm
Domain name of the target repository.
Obtain it from the repository URL on the self-hosted repo page in Step 3: Obtaining Repository URL and Configuration File.
target_repo
xx-north-xxx_xxxxxxxx_maven_1_388
xx-north-xx_xxxxxxx_npm_6944
Target registry name.
Obtain it from the repository URL in Step 3: Obtaining Repository URL and Configuration File.
target_user_name
username
Username of the target repository, which can be obtained from Step 3: Obtaining Repository URL and Configuration File.
target_password
password
Password of the target repository, which can be obtained from Step 3: Obtaining Repository URL and Configuration File.
Simple application-nexus.yaml
spring: main: web-application-type: none relocation: # Name of the migration task (only for display) name: nexus-to-artifact Migration package type: maven, npm, PyPI, and Go package_type: maven # Migration type. Governance, JFrog, Nexus3, and Nexus2 are available. migrate_type: "nexus3" # Cache path, which is mandatory for migrating Maven. The path ends with a slash (/). The last uploaded snapshot version of the Maven is stored in this path. save_temp_dir: "D:/tmp/xxx/" # Original repository parameter. It is mandatory only in the JFrog and Nexus scenarios. # Original repository URL. The URL must not end with a slash (/). domain: 'http://{domain}/artifactory' # Original repository name repo: 'test-maven' # Original repository username user_name: "username" # Original repository password password: "password" # Target repository parameter # Target repository URL. The last path cannot contain a slash (/). Obtain the path from the page. target_domain: 'https://{domain}/artgalaxy/xxxx/xxxx' # Target repository name target_repo: xxxxx # Target repository username target_user_name: 'username' # Target repository password target_password: 'password' - Configure parameters in the application.yaml file.
spring: main: web-application-type: none relocation: # General configuration of the migration program # Number of core threads of the migration program corePoolSize: 20 # Maximum number of thread pools of the migration program maxPoolSize: 40 # Thread pool queue size of the migration program queueCapacity: 99999999 # Maximum migration speed of the migration program (MB/s). The default value is 20. speed_limit: 20 # JFrog migration scenario parameter. This parameter indicates the migration packages between the time of modifiedFrom and modifiedTo (timestamp). modifiedFrom: modifiedTo: # Name of the migration task (only for display) name: jfrog-to-artifact # Package type of the repository to be migrated package_type: pypi # Migration type. Governance, JFrog, and Nexus are available. migrate_type: "jfrog" # Cache path, which is mandatory for migrating Maven. The value ends with a slash (/). save_temp_dir: "/xxxx/" # Original repository parameter. It is mandatory only in the JFrog and Nexus scenarios. # Original repository URL. The URL must not end with a slash (/). domain: 'http://{domain}/artifactory' # Original repository name repo: 'test-pypi-source' # Original repository type. The default value is artifactory. repo_type: artifactory # Original repository username user_name: "username" # Original repository password password: "password" # In the JFrog scenario, enter the sub-path of the original repository. Sub-path migration is supported. source_sub_path: # Target repository parameter # Target repository URL. The last path cannot contain a slash (/). Obtain the path from the page. target_domain: 'https://{domain}/artgalaxy/xxxx/xxxx' # Target repository name target_repo: xxxxx # Target repository type. The default value is artifactory. target_repo_type: artifactory # Target repository username target_user_name: 'username' # Target repository password target_password: 'password' # Governance migration parameters (ignore for Python migration) # domain_id in the governance migration scenario domain_id: test009 # Whether to call CodeArts Governance in the governance scenario. If the value is true, CodeArts Governance is not called. call_governance_use_local: true # Package type of the governance migration repository governance_type: npm # Path for storing the CodeArts Governance entity package. migrate_local_path: "" # Governance metadata file, indicating the metadata file to be migrated migrate_metadata_path: "" # Callback governance path. An empty path needs to be set for this path. governance_save_path: "" # Callback CodeArts Governance URL governance_url: "" # User AK. It is used to call back the CodeArts Governance API. access_key_id: "" # User SK. It is used to call back the CodeArts Governance API. secret_access_key: "" # Whether to call back CodeArts Governance only through the cache information in governance_save_path. only_update_governance: false # Maximum number of files to be migrated in the CodeArts Governance. The number is the number of metadata records in migrate_metadata_path. migrate_max_num: -1
Step 5: Migrating
- Run the following migration script:
java -jar relocation-jfrog-20251016.1.jar --spring.config.location=application-nexus.yaml > /log/relocation-jfrog.log 2>&1 &
- Go to the target self-hosted repo (local repository) and check whether the component package is successfully uploaded to the hosted repository.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot