0

I am trying to deploy to my archiva repo using Jenkins and maven. I am using the "post-build actions" option: "deploy artifacts to maven repository" and I have added the configuration plugin where I added a settings.xml and defined the server details (id, username, password). I also added this file to "build environment" settings where I provided the file as a configuration file.

The problem I am having is the error: not authorized , reasonphrase: unauthorized.

The username and password are for a user with role "repository manager" as the archiva doc instructs. I have set up the pom.xml as well, like the documentation instructs.

I notice that the first error is: ERROR: failed to retrieve remote metadata someGroupId:someArtifactId:someVersion-SNAPSHOT/maven-metadata.xml I don't understand where the error comes from and how to resolve it. Please help.

Ree
  • 863
  • 2
  • 18
  • 38

1 Answers1

0

Some suggestions:

1.) Ensure that you have all your servers listed in your Maven settings.xml. This gets me sometimes.

2.) Ensure that your snapshot repo id matches the repo id defined within Archiva.

3.) Ensure that you have access to the snapshots repo, even as admin. Permissions can be revoked.

4.) Ensure that you have the right password.

5.) I've had a restart of Archiva fix this problem before.

6.) The following settings.xml config will allow you to deploy snapshots to a custom snapshots repo that's part of a repository group (i.e. - a snapshots repo for a particular team):

<mirror>
    <id><repo_group_id></id>
    <mirrorOf>*, !<team_snapshot_repo_id></mirrorOf>
    <name>My Team's Maven Repository</name>
    <url>http://<HOST>:<PORT>/archiva/repository/<repo_group_id>/</url>
</mirror>

7.) Here's what I add to my pom.xml if I want to deploy the artifact to my snapshots Maven repo:

<distributionManagement>
    <repository>
        <id>internal</id>
        <url>http://HOST:PORT/archiva/repository/internal/</url>
    </repository>
    <snapshotRepository>
        <id>snapshots</id>
        <name>Archiva Managed Snapshot Repository</name>
        <url>http://HOST:PORT/archiva/repository/snapshots/</url>
        <layout>default</layout>
    </snapshotRepository>
</distributionManagement>

<repositories>
    <repository>
        <id>snapshots</id>
        <url>http://HOST:PORT/archiva/repository/snapshots/</url>
        <releases>
            <enabled>false</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>
Chris Harris
  • 1,329
  • 4
  • 17
  • 28