Help Center/ CodeArts Artifact/ FAQs/ Self-Hosted Repo/ Why Is Error 401 Returned When Uploading Maven Components to Self-Hosted Repos?
Updated on 2024-10-17 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 pom.xml file does not match the settings.xml file.

Solution

When uploading 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. Go to the self-hosted repo page, and choose Maven from the repository list.
  2. Click Tutorial in the upper right corner.
  3. Configure the local Maven tool by following the configuration guide.
  4. Run mvn deploy to upload the Maven project.

    1. 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.

    2. Upload the local JAR package:
      mvn deploy:deploy-file -DgroupId=com.huawei -DartifactId=aopalliance -Dversion=1.0 -Dpackagi=jar