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:
- Go to the self-hosted repo page, and choose Maven from the repository list.
- Click Tutorial in the upper right corner.
- Configure the local Maven tool by following the configuration guide.
- 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.
- Upload the local JAR package:
mvn deploy:deploy-file -DgroupId=com.huawei -DartifactId=aopalliance -Dversion=1.0 -Dpackagi=jar
- 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.
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