admin管理员组

文章数量:1202577

I can't figure out what might be causing this 401 Unauthorized error when trying to deploy to my project's maven registry from my local workstation. Hoping there might be some maven users willing to take a look at my config.

C:\Users\jim\Desktop\upload-test>mvn deploy:deploy-file -DpomFile="pom.xml" -DgroupId="com.wibu" -DartifactId=codemeter -Dversion="8.20" -Dpackaging="jar" -Dfile="CodeMeter.jar" -DrepositoryId="gitlab-maven" -Durl="/api/v4/projects/5835/packages/maven/" -Dauthentication.username="jim" -Dauthentication.password="glpat-my_acc_token_here"
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------------< com.wibu:codemeter >-------------------------
[INFO] Building codemeter 8.20
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- deploy:3.1.1:deploy-file (default-cli) @ codemeter ---
Uploading to gitlab-maven: /api/v4/projects/5835/packages/maven/com/wibu/codemeter/8.20/codemeter-8.20.jar
Uploading to gitlab-maven: /api/v4/projects/5835/packages/maven/com/wibu/codemeter/8.20/codemeter-8.20.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.633 s
[INFO] Finished at: 2025-01-20T17:13:16-08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:3.1.1:deploy-file (default-cli) on project codemeter: Failed to deploy artifacts: Could not transfer artifact com.wibu:codemeter:jar:8.20 from/to gitlab-maven (/api/v4/projects/5835/packages/maven/): status code: 401, reason phrase: Unauthorized (401) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] 

settings.xml

<settings xmlns=".0.0" xmlns:xsi=";
  xsi:schemaLocation=".0.0 .0.0.xsd">
  
  <proxies>
    <proxy>
      <id>appgate-proxy</id>
      <active>true</active>
      <protocol>http</protocol>
      <host>localhost</host>
      <port>3128</port>
    </proxy>
  </proxies>

  <servers>
    <server>
      <id>gitlab-maven</id>
      <configuration>
        <httpHeaders>
          <property>
            <name>jim</name>
            <value>glpat-my_token_here</value>
          </property>
        </httpHeaders>
      </configuration>
    </server>
  </servers>

  <mirrors>
    <mirror>
      <id>maven-public</id>
      <url>/repository/maven-public</url>
      <mirrorOf>*</mirrorOf>
    </mirror>
  </mirrors>
</settings>

pom.xml

<project xmlns=".0.0"
         xmlns:xsi=";
         xsi:schemaLocation=".0.0 .0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.wibu</groupId>
    <artifactId>codemeter</artifactId>
    <version>8.20</version>
    <packaging>jar</packaging>

    <repositories>
      <repository>
        <id>gitlab-maven</id>
        <url>/api/v4/projects/5835/packages/maven</url>
      </repository>
    </repositories>
    <distributionManagement>
      <repository>
        <id>gitlab-maven</id> 
        <url>/api/v4/projects/5835/packages/maven</url> 
      </repository>
      <snapshotRepository>
        <id>gitlab-maven</id>
        <url>/api/v4/projects/5835/packages/mavenn</url>
      </snapshotRepository>
    </distributionManagement>

</project>

This is with maven version 3.9.4 and gitlab v17.7.1-ee

本文标签: 401 Unauthorized error deploying to gitlab maven registryStack Overflow