Maven: Failed to use artifacts, Acces denied

I have a Sonatype Nexus server and I want to deploy a snapshot.

This is a snippet of my settings.xml file:

<servers> <server> <id>test-snapshots</id> <username>myname1</username> <password>mypasswd1</password> </server> <server> <id>test-releases</id> <username>myname2</username> <password>mypasswd2</password> </server> </servers> 

And this is a fragment of my pom.xml file:

 <distributionManagement> <repository> <id>test-releases</id> <name>Releases</name> <url>https://nxs.company.com/content/repositories/test-releases</url> </repository> <snapshotRepository> <id>test-snapshots</id> <name>Snapshots</name> <url>https://nxs.company.com/content/repositories/test-snapshots</url> </snapshotRepository> </distributionManagement> 

Running mvn deploy (Maven 3.0.3) I get this error:

 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy (default-deploy) on project MyProject: Failed to deploy artifacts: Could not transfer artifact com.company.project:MyProject:jar:1.0.0-20121003.154427-1 from/to test-snapshots (https://nxs.company.com/content/repositories/test-snapshots): Access denied to: https://nxs.company.com/content/repositories/test-snapshots/ com.company.project/MyProject/1.0.0-SNAPSHOT/MyProject-1.0.0-20121003.154427-1.jar -> [Help 1] 

And in my Nexus log file, I see that no credentials were received, so he will try this later with anonymous, and this, of course, will fail. So why are there no credentials passed to Nexus?

 2012-10-03 17:24:14 DEBUG [1027496148-8353] - org.apache.shiro.session.mgt.DefaultSessionManager - Unable to resolve session ID from SessionKey [ org.apache.shiro.web.session.mgt.WebSessionKey@791a17dc ]. Returning null to indicate a session could not be found. 2012-10-03 17:24:14 DEBUG [1027496148-8353] - org.sonatype.nexus.security.filter.authc.NexusContentAuthenticationFilter - No authorization found (header or request parameter) 2012-10-03 17:24:14 DEBUG [1027496148-8353] - org.sonatype.nexus.security.filter.authc.NexusContentAuthenticationFilter - No authorization found (header or request parameter) 2012-10-03 17:24:14 DEBUG [1027496148-8353] - org.sonatype.nexus.security.filter.authc.NexusContentAuthenticationFilter - Attempting to authenticate Subject as Anonymous request... 2012-10-04 17:24:14 DEBUG [1027496148-8353] - org.sonatype.security.ldap.realms.DefaultLdapContextFactory - Initializing LDAP context using URL [ldap://10.100.100.1:3268/DC=company,DC=com] and username [ ldap@company.com ] with pooling [enabled] 
+6
source share
1 answer

Do you really have a different username / password for each repository on Nexus? This will cause a maven http wagon problem, since jvm caches credentials for each host, and although maven provides alternate credentials properly, jvm will not use them. A workaround to this is to use a web carriage instead, since it uses the apache http client, not the jdk urlclient.

+1
source

Source: https://habr.com/ru/post/926975/


All Articles