Updated on 2026-08-10 GMT+08:00

Uploading and Downloading a Maven Artifact via the Client

CodeArts Artifact can connect to local clients. You may upload your private packages from your local client to self-hosted repos and share them with others, who can download these packages through their clients.

Maven Artifact

Maven artifacts are the output files generated during the Maven build process, which usually include compiled code (e.g., JARs, WARs, and EARs) and related metadata, such as dependency information and version numbers. For details, see Uploading a Maven Artifact.

Constraints

The repository password for a self-hosted repo is account-specific. If you are prompted for a password while using a different account, download the configuration file from the repository's Tutorial tab to obtain it.

Prerequisites

Uploading a Maven Artifact via the Client

  • The client tool is Maven. Ensure that the JDK and Maven have been installed.
    1. Access self-hosted repos using your Huawei Cloud account.
    2. Select the target Maven repository from the repository list.
    3. Click Tutorial on the right of the page.
    4. In the displayed dialog box, set Select dependency manager to Maven.
    5. Click Download Configuration File to download the settings.xml file. Replace the downloaded file or modify your Maven settings.xml file as prompted.

    6. Run the following commands (example) in the directory where the uploaded POM file is located:
      mvn deploy:deploy-file -DgroupId={groupId} -DartifactId={artifactId} -Dversion={version} -Dpackaging=jar -Dfile={file_path} -DpomFile={pom_path} -Durl={url} -DrepositoryId={repositoryId} -s {settings_path} -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true
      • Parameter description
        • DgroupId: uploaded group ID
        • DartifactId: uploaded artifact ID
        • Dversion: version of the uploaded file
        • Dpackaging: type of the package to be uploaded, such as JAR, ZIP, and WAR
        • Dfile: path of the uploaded entity file
        • DpomFile: path of the entity POM file to be uploaded. (For a release version, if this parameter does not exist, the system automatically generates a POM file. If there are special requirements for the POM file, specify this parameter.)
        • The values of DgroupId, DartifactId, and Dversion in the POM file must be the same as those outside the POM file. Otherwise, error 409 is reported.
        • Select either DpomFile or (DgroupId, DartifactId, and Dversion).
        • Durl: path for uploading files to the repository.
        • DrepositoryId: ID corresponding to the username and password configured in settings, as shown in the following figure:

  • The client tool is Gradle. Ensure that JDK and Gradle have been installed.
    1. Access self-hosted repos using your Huawei Cloud account.
    2. In the left pane, click the name of the repository to be connected to your local development environment.
    3. Click Tutorial on the right of the page.
    4. In the displayed dialog box, set Select dependency manager to Gradle.
    5. Click Download the provided configuration file to download the init.gradle file from the self-hosted repo page.

    6. Find the build.gradle file in the local project and add the following commands to the gradle file:
      uploadArchives {
          repositories {
              mavenDeployer {repository(url:"***") {
                      authentication(userName: "{repo_name}", password: "{repo_password}")
                  }
                  // Pom file of the build project
                  pom.project {
                      name = project.name
                      packaging = 'jar'
                      description = 'description'
                  }
              }
          }
      }
      • url: path for uploading files to the repository. You can click on the Maven repository page to obtain the URL.
      • {repo_name}: username obtained from the init.gradle file downloaded from the Maven repository page.
      • {repo_password}: password obtained from the init.gradle file downloaded from the Maven repository page.
    7. Run the following command in the directory where the local project is located:
      gradle uploadArchives
    8. Return to the target Maven repository to view the uploaded artifact.

Downloading a Maven Artifact via the Client

The client tool is Maven. Ensure that the JDK and Maven have been installed.
  1. Access self-hosted repos using your Huawei Cloud account.
  2. Select the target Maven repository on the self-hosted repo page.
  3. Click Tutorial on the right of the page.
  4. In the displayed dialog box, set Select dependency manager to Maven.
  5. Click Download Configuration File to download the settings.xml file. Replace the settings.xml file with the downloaded file or modify your Maven settings.xml file as prompted.

  6. Download the artifact to the repository using the client.
    mvn dependency:get -DremoteRepositories={repo_url} -DgroupId={groupId} -DartifactId={artifactId} -Dversion={version} -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true