Why can't I upload the artifact to archiva (unauthorized), but I can upload it using admin?

I have been working with archiva for about a year,

I download my jars manually using the archiva GUI and it works great.

Now I want to download the maven deployment artifact, the problem is I am getting 401-Unauthorized . Do not forget that:

1.) I can download from this repository without any problem.

2.) I am using admin user.

3.) I can download with this user manually.

this is the log I am getting:

[com:apinterface.parent] Downloading: http://xx.xx.xx.xx:9080/archiva/repository/snapshots/com/apinterface.parent/1.0-SNAPSHOT/maven-metadata.xml

[11:43:39][Step 1/3] [INFO] ------------------------------------------------------------------------
[11:43:39][Step 1/3] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project apinterface.parent: Failed to deploy artifacts: Could not transfer artifact com:apinterface.parent:pom:1.0-20140924.084338-1 from/to snapshots (http://xx.xx.xx.xx:9080/archiva/repository/snapshots): Failed to transfer file: http://xx.xx.xx.xx:9080/archiva/repository/snapshots/com/apinterface.parent/1.0-SNAPSHOT/apinterface.parent-1.0-20140924.084338-1.pom. Return code is: 401, ReasonPhrase: Unauthorized. -> [Help 1]

      

+3


source to share


1 answer


This must be because you have not configured Maven to use the Archiva username and password to download artifacts during the deployment phase.

I am assuming you have already set up a distributionManagement section in your pom file.

<distributionManagement>
    <snapshotRepository>
        <id>snapshots</id>
        <name>Internal Snapshots</name>
        <url>http://xx.xx.xx.xx:9080/archiva/repository/snapshots/</url>
    </snapshotRepository>
    <repository>
        <id>releases</id>
        <name>Internal Releases</name>
        <url>http://xx.xx.xx.xx:9080/archiva/repository/releases</url>
    </repository>
</distributionManagement>

      



You must have servers with matching IDs in your Maven settings file (like in the example below) in order to configure the username / password that maven should use when uploading (deploying) artifacts

<settings>
  <servers>
    <server>
      <id>snapshots</id>
      <username>archiva-user</username>
      <password>archiva-pwd</password>
    </server>
    <server>
      <id>releases</id>
      <username>archiva-user</username>
      <password>archiva-pwd</password>
    </server>
  </servers>
</settings>

      

+6


source







All Articles