Help Center> CodeArts Artifact> FAQs> Self-Hosted Repo> Why Is Error 401 Returned When Uploading Maven Components to Self-hosted Repos?
Updated on 2023-11-06 GMT+08:00

Why Is Error 401 Returned When Uploading Maven Components to Self-hosted Repos?

Symptom

Failed to upload Maven components to self-hosted repos from the local IDE, and 401-Insufficient Permission is displayed.

Cause Analysis

The self-hosted repo information configured in the code repository file pom.xml does not match the settings.xml file.

Solution

When uploading the components, replace the repository_id value in the distributionManagement element of the pom.xml file with the repository_id value in the server element of the settings.xml file.

The uploading process is as follows:

  1. Access the self-hosted repo homepage, and choose Maven from the repository list.
  2. Click Set Me Up in the upper right corner. The Configuration Guide dialog box is displayed.
  3. Configure the local Maven tool by following the configuration guide.
  4. Run mvn deploy to upload the Maven project.

    • In the Maven CLI, access the directory where the pom.xml file of the Maven project is stored, check whether the repository_id value in the distributionManagement element of the pom.xml file matches the repository_id value in the server element of the settings.xml file.

    • Run the following command to upload the local JAR package:
      mvn deploy:deploy-file -DgroupId=com.huawei -DartifactId=aopalliance -Dversion=1.0 -Dpackagi=jar

Self-Hosted Repo FAQs

more