Maven 2 works but Maven 3 gives authentication error with same settings and server

484 views Asked by At

I'm setting up a new archiva server and a new project. Right now I have a very simple pom and nothing really that interesting on the server.

When I 'mvn compile -U' using maven2 from the command line I'm able to access my archiva server and download a plugin as part of the build. However, when I switch to maven3 (same settings.xml) I get an error when I 'mvn compile -U':

Plugin org.codehaus.mojo:exec-maven-plugin:1.4.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.codehaus.mojo:exec-maven-plugin:jar:1.4.0: Could not transfer artifact org.codehaus.mojo:exec-maven-plugin:pom:1.4.0 from/to central-proxy (http://archiva.myserver.com/repository/internal): Not authorized , ReasonPhrase:Unauthorized.

I don't see anything interesting in the debug info when I build with the '-X' flag, and I don't see anything on the server log files either.

Right now I'm using only the username and password fields in my settings.xml. From the documention, I should be able to just use those fields - privateKey is optional.

Anyone else have problems when switching between maven2 and maven3 with the same settings?

1

There are 1 answers

0
Robert A. Decker On

After spending a day or two trying to figure this out, it looked to me as if maven3 was not sending my credentials. So instead of using the username and password fields I embedded my credentials in the urls to my repositories, such as:

<url>http://username:[email protected]/repository/internal/</url>

This works. I no longer it an unauthorized error from the server.