Search code examples
mavenarchiva

Why can't I download an artifact from Archiva? ReasonPhrase: Unauthorized


Our archiva repository experienced the case where the Admin ID expired and we could not recover it. Following this fix: How to reset Apache Archiva Password we deleted the user database and restarted Archiva.

Upon restart and after adding a new artifact to the internal repository, the error below was thrown during maven execution:

mvn clean package -U

Could not resolve dependencies for ...  Could not transfer artifact com.package.... from/to ... Not authorized, ReasonPhrase:Unauthorized.

How can we make this work properly?


Solution

  • When the user database is rebuilt automatically by archiva, the Guest ID may not have access to the internal repository. In that case, the following worked for us.

    1. Log in as Admin and select Manage from the left navigator.

    2. On the User List, select the Guest User and edit it.

    3. Select the Edit Roles button.

    4. Under Archiva, find the checkbox labeled "internal" under "Repository" and check it.

    5. Click Update.

    6. Retry the maven build and it should succeed now if this box was previously not checked.