tencent cloud


Maven Repository

Last updated: 2022-03-30 10:08:16

    This document describes how to store Maven artifacts in CODING-AR, including how to create a repository and push and pull artifacts.

    Open CODING-AR

    1. Log in to the CODING Console and click Use Now to go to CODING page.
    2. Click in the upper-right corner to open the project list page and click a project icon to open the project.
    3. In the menu on the left, click Artifact Management.

    Create an Artifact Repository

    Click Create Repository.

    • Select Maven as the repository type.
    • Enter a repository name.
    • Enter a repository description (optional).
    • Configure the permissions of different roles on the current repository. By default, all project members have the Pull and Push permissions.
    • Click Create.

    Configure Authentication Information

    Authentication information must be configured before you can pull artifacts from or push artifacts to CODING-AR.

    Configure authentication information in either of the following ways:

    • Configure the access token in settings.xml.
    • Configure your CODING account and password in settings.xml.

    We recommend you use an access token to generate the authentication configuration.


    For details about the Maven settings.xml, refer to FAQs.

    Method 1: generate configuration from access token

    1. On the guide page, click Generate configuration from access token and enter the account login password in the pop-up window.
    2. Copy the configuration generated and add it to settings.xml.

    Method 2: configure account password manually

    On the guide page, copy the following configuration, replace PASSWORD with your login password, and then add the configuration to settings.xml.

    Compile and Upload a Maven Artifact

    This section describes how to push a demo Maven package to the repository created above.

    1. On the guide page, copy the following configuration to pom.xml.

      Generally, groupId, artifactId, and version configurations already exist for a Maven project. You only need to add distributionManagement to it.
    2. Run the mvn deploy command.
      mvn deploy
      If settings.xml is not found, add `-s` to the end of the command and add the path of the settings file.
      mvn deploy -s "/Users/somebody/software/apache-maven-3.6.2/conf/settings.xml"
    3. If a build success message is displayed, refresh the repository page to view the latest artifacts.

    Upload a Maven Package Without Source Code

    If a third-party Maven package is not officially released to a repository and only a JAR package is provided without source code, you can upload the JAR package to the repository by running the following command:

    mvn deploy:deploy-file -Durl=file://C:\m2-repo \
    -DrepositoryId=some.id \
    -Dfile=your-artifact-1.0.jar \
    [-DpomFile=your-pom.xml] \
    [-DgroupId=org.some.group] \
    [-DartifactId=your-artifact] \
    [-Dversion=1.0] \
    [-Dpackaging=jar] \
    [-Dclassifier=test] \
    [-DgeneratePom=true] \
    [-DgeneratePom.description="My Project Description"] \

    If pom.xml is provided by the third party, you can obtain group, artifact, and version information. For example, use the following command for the WeChat Cloud Pay Java SDK:

    mvn deploy:deploy-file --settings ./settings.xml -Durl=https://coding-public-maven.pkg.coding.net/repository/tencent-cloud-pay-sdk-java/tencent/ \
    -DrepositoryId=coding-public-tencent-cloud-pay-sdk-java-tencent \
    -Dfile=../cloudpay.jar \

    The following illustrates the JAR package upload page.

    Pull a Maven Artifact

    1. On the guide page, copy the configuration to settings.xml. For example, the configuration for the WeChat Cloud Pay Java SDK is as follows:
      <!-- omitted xml -->
      <id>Repository Proxy</id>
    2. Configure the dependencies in the pom.xml file of your Java project. For example, for the WeChat Cloud Pay Java SDK, the configuration is as follows:
    3. Compile the project.
      mvn install -s ./settings.xml

    You can view the package is being pulled during the execution. Alternatively, view the pulled package in the local maven cache after the execution is completed.

    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support