• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Maven deploy to Nexus repository error

 
Bob pat
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I am trying to deploy to Nexus repository, but I am getting following error. Would someone help me?


[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:
deploy (default-deploy) on project my-test: Failed to deploy artifacts: Could no
t transfer artifact org.bhavesh:my-test:jar:1.0-20140326.192116-1 from/to deploy
ment (http://localhost:8081/nexus/content/repositories/snapshots/): Failed to tr
ansfer file: http://localhost:8081/nexus/content/repositories/snapshots/org/bhav
esh/my-test/1.0-SNAPSHOT/my-test-1.0-20140326.192116-1.jar. Return code is: 401,
ReasonPhrase: Unauthorized. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception

-----------------------------------------------------------------------
Ran with -X switch

[DEBUG] Using connector WagonRepositoryConnector with priority 0.0 for http://localhost:8081/nexus/content/repositories/snapshots/
Downloading: http://localhost:8081/nexus/content/repositories/snapshots/org/bhavesh/my-test/1.0-SNAPSHOT/maven-metadata.xml

[DEBUG] Could not find metadata org.bhavesh:my-test:1.0-SNAPSHOT/maven-metadata.xml in deployment1 (http://localhost:8081/nexus/content/repositories/snapshots/)
[DEBUG] Writing tracking file C:\Users\Bob\.m2\repository\org\bhavesh\my-test\1.0-SNAPSHOT\resolver-status.properties
Uploading: http://localhost:8081/nexus/content/repositories/snapshots/org/bhavesh/my-test/1.0-SNAPSHOT/my-test-1.0-20140328.195302-1.jar
2/3 KB
3/3 KB

Uploading: http://localhost:8081/nexus/content/repositories/snapshots/org/bhavesh/my-test/1.0-SNAPSHOT/my-test-1.0-20140328.195302-1.pom
2/2 KB

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.434 s
[INFO] Finished at: 2014-03-28T14:53:02-06:00
[INFO] Final Memory: 7M/18M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project my-test: Failed to deploy artifacts: Could not transfer artifact org.bhavesh:my-test:jar:1.0-20140328.195302-1 from/to deployment1 (http://localhost:8081/nexus/content/repositories/snapshots/): Failed to transfer file: http://localhost:8081/nexus/content/repositories/snapshots/org/bhavesh/my-test/1.0-SNAPSHOT/my-test-1.0-20140328.195302-1.jar. Return code is: 401, ReasonPhrase: Unauthorized. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project my-test: Failed to deploy artifacts: Could not transfer artifact org.bhavesh:my-test:jar:1.0-20140328.195302-1 from/to deployment1 (http://localhost:8081/nexus/content/repositories/snapshots/): Failed to transfer file: http://localhost:8081/nexus/content/repositories/snapshots/org/bhavesh/my-test/1.0-SNAPSHOT/my-test-1.0-20140328.195302-1.jar. Return code is: 401, ReasonPhrase: Unauthorized.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)

----------------------------------------------------------------------------------------------------------

Here is POM.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.bhavesh</groupId>
<artifactId>my-test</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>my-test</name>
<url>http://maven.apache.org</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>

<distributionManagement>
<snapshotRepository>
<id>deployment1</id>
<name>Internal Releases</name>
<url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
</project>

-------------------------------------------------------------------------------------

The settings.xml has following:

<servers>
<server>
<id>deployment1</id>
<username>deployment</username>
<password>deployment123</password>
</server>
</servers>


Thanks,
Bob
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33684
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you login to Nexus on your machine and try to upload an artifact to http://localhost:8081/nexus/content/repositories/snapshots/org/bhavesh/my-test? I'm guessing that will fail with the same error showing the permissions are incorrect.

Then login to Nexus as an admin and look what permissions are set. You can post the relevant ones here for more opinions.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, where is your settings.xml file located? I have seen instances where it was one one account's .m2 directory and the person was using another account to do the compile. And cases where the file was in the Maven conf directory but the user was using a different copy of Maven to do the compile (very easy to do when using Eclipse or some other IDE which has its own embedded copy of Maven).
 
Bob pat
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Peter,
My setting files at my home directory. I ran with -X option and it looks ok to me.

[DEBUG] Reading global settings from C:\maven\apache-maven-3.2.1\bin\..\conf\settings.xml
[DEBUG] Reading user settings from C:\Users\Bob\.m2\settings.xml
[DEBUG] Using local repository at C:\Users\Bob\.m2\repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for C:\Users\Bob\.m2\repository

---------------------------------------------------------------------------------------------------------------------------------------

Hi Jeanne,
I try to upload an artifact to http://localhost:8081/nexus/content/repositories/snapshots/org/bhavesh/my-test? , but get following

404 - ItemNotFoundException

Path /org/bhavesh/my-test not found in local storage of repository "Snapshots" [id=snapshots]

org.sonatype.nexus.proxy.ItemNotFoundException: Path /org/bhavesh/my-test not found in local storage of repository "Snapshots" [id=snapshots]
at org.sonatype.nexus.proxy.storage.local.fs.DefaultFSLocalRepositoryStorage.retrieveItemFromFile(DefaultFSLocalRepositoryStorage.java:260)
at org.sonatype.nexus.proxy.storage.local.fs.DefaultFSLocalRepositoryStorage.retrieveItem(DefaultFSLocalRepositoryStorage.java:285)
at org.sonatype.nexus.proxy.repository.AbstractRepository.doRetrieveLocalItem(AbstractRepository.java:1248)
at org.sonatype.nexus.proxy.repository.AbstractRepository.doRetrieveItem(AbstractRepository.java:1240)

As you said I login as admin and look at permission and deployment Userid has full control on all repositories.

Note: I have uploaded Releases repositories using GUI, but snapshot repositories doesn't have option to upload in GUI.

Also, I have notice that when I ran with -X potion it said could not find metadata. Do you think I am missing something?

Thanks,
Bob.


 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic