Migrating Hosted Repository Data from Nexus to CodeArts Artifact
You can use the migration tool of CodeArts Artifact to migrate hosted repositories from Nexus to CodeArts Artifact. 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
- You have completed the operations in Migration Preparations.
- The runtime environment is JDK 17. Run the java -version command to verify your environment. For details about how to install JDK 17, see https://www.java.com.
- The host 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:
- 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 in Step 3: Obtain the Repository URL and Configuration File).
- 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 in Step 3: Obtain the Repository URL and Configuration File.)
Step 1: Identify 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: Create 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: Obtain the Repository URL and Configuration File
- Obtain the repository URL.
- Find the repository created in Step 2: Create a Local Repository in Self-Hosted Repos and click Repo View.
- Click the repository name. The Repo URL is displayed on the General tab. Click
to copy the repository URL. 
- Obtain the configuration file.
- Click Tutorial in the upper right corner of the page.
- In the Tutorial dialog box, click Download Configuration File to download the settings.xml file to the local host.

- Open the settings.xml file on the localhost, locate the <username> and <password> lines, and extract the username and password as shown in the following figure.

Step 4: Configure 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-XXX.jar; configuration file: application-nexus.yaml) to the localhost. - Configure the application-nexus.yaml file by referring to the following table. The table includes only the minimum required configuration 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 categorized into Release and Snapshot repositories. If your original repository contains both types, you will need to perform migrations for Release and Snapshot, separately.
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 and must end with a slash (/). This path is used to cache Maven snapshot versions and upload the cached files.
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: Obtain the Repository URL and Configuration File.
target_repo
xx-north-xxx_xxxxxxxx_maven_1_388
xx-north-xx_xxxxxxx_npm_6944
Target repository name.
Obtain it from the repository URL in Step 3: Obtain the Repository URL and Configuration File.
target_user_name
username
Username of the target repository, which can be obtained from Step 3: Obtain the Repository URL and Configuration File.
target_password
password
Password of the target repository, which can be obtained from Step 3: Obtain the Repository URL and Configuration File.
application-nexus.yaml with the minimum configurations
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 and must end with a slash (/). This path is used to cache Maven snapshot versions and upload the cached files. save_temp_dir: "D:/tmp/xxx/" # Original repository parameters, 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 parameters # Target repository URL. The path must not end with 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' - To configure all parameters in the application.yaml file, refer to the following example.
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 parameters, indicating that the packages modified between the timestamps modifiedFrom and modifiedTo will be migrated. modifiedFrom: modifiedTo: # Name of the migration task (only for display) name: jfrog-to-artifact # Package type of the repository to be migrated package_type: maven # Migration type. Governance, JFrog, and Nexus are available. migrate_type: "nexus" # Cache path, which is mandatory for migrating Maven and must end with a slash (/). save_temp_dir: "/xxxx/" # Original repository parameters, 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-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 subpath of the original repository. Subpath migration is supported. source_sub_path: # Target repository parameters # Target repository URL. The path must not end with 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: maven # Path for storing the CodeArts Governance entity package migrate_local_path: "" # Governance metadata file, indicating the metadata file to be migrated migrate_metadata_path: "" # Path for calling back governance. An empty path needs to be set for this path. governance_save_path: "" # URL for calling back CodeArts Governance 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 CodeArts Governance files to be migrated. It is the number of metadata records in migrate_metadata_path. migrate_max_num: -1
Step 5: Migrate Data
- 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 local repository and check whether the package is successfully uploaded to the hosted repository.
Step 6: Build with a Migrated Repository in CodeArts Artifact
After migrating the repository, access it, click Tutorial in the upper-right corner to download the configuration file, and then upload this file to the code repository to be built and select it during build.

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