Reputation: 170
If I trying to upload a jar using command
mvn deploy:deploy-file \
-DgroupId=log4j \
-DartifactId=log4j-gwt \
-Dversion=1.0 \
-Dpackaging=jar \
-Dfile=log4j-gwt.jar \
-DrepositoryId=nexus \
-Durl=http://2.23.45.65:8081/nexus/content/repositories/central
I get error
Downloaded: http://2.23.45.65:8081/nexus/content/repositories/central/org/codehaus/plexus/plexus-utils/3.0.15/plexus-utils-3.0.15.jar (0 B at 0.0 KB/sec)
Uploading: http://2.23.45.65:8081/nexus/content/repositories/central/log4j/log4j-gwt/1.0/log4j-gwt-1.0.jar
Uploading: http://2.23.45.65:8081/nexus/content/repositories/central/log4j/log4j-gwt/1.0/log4j-gwt-1.0.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.964s
[INFO] Finished at: Mon Mar 21 16:45:42 MSK 2016
[INFO] Final Memory: 6M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy-file (default-cli) on project gwtclient: Failed to deploy artifacts: Could not transfer artifact log4j:log4j-gwt:jar:1.0 from/to nexus (http://2.23.45.65:8081/nexus/content/repositories/central): Failed to transfer file: http://2.23.45.65:8081/nexus/content/repositories/central/log4j/log4j-gwt/1.0/log4j-gwt-1.0.jar. Return code is: 401
Bellow described how Nexus repository configured in the settings.xml
<mirror>
<id>nexus</id>
<url>http://2.23.45.65:8081/nexus/content/repositories/central/</url>
<mirrorOf>central</mirrorOf>
</mirror>
Also I tried to configure groups/public repository. In settings.xml
<server>
<id>nexus_public</id>
<username>username</username>
<password>passwd</password>
<filePermissions>664</filePermissions>
<directoryPermissions>775</directoryPermissions>
<configuration></configuration>
</server>
In pom.xml
<repositories>
<repository>
<id>nexus_public</id>
<url>http://2.23.45.65:8081/nexus/content/groups/public/</url>
</repository>
</repositories>
And trying to run command
mvn deploy:deploy-file \
-DgroupId=log4j \
-DartifactId=log4j-gwt \
-Dversion=1.0 \
-Dpackaging=jar \
-Dfile=log4j-gwt.jar \
-DrepositoryId=nexus_public \
-Durl=http://2.23.45.65:8081/nexus/content/groups/public
But I get same error.
Also I tried to find Component Upload Tab as described in this article https://books.sonatype.com/nexus-book/reference/using-sect-uploading.html
But I couldn't find this tab in the Nexus Repository Manager OSS. This should be after the tab Summary, but it's not there.
Upvotes: 1
Views: 6087
Reputation: 5320
-DrepositoryId=nexus
That is wrong, you need to use the ID of the server section in your settings.xml file that has your login credentials.
Try using:
-DrepositoryId=nexus_public
Also, I can't tell what kind of repository "central" is from your command, but by default Nexus ships with a a proxy repository named "central". You can't upload to proxy or group repositories, you can only upload to hosted repositories.
Upvotes: 1
Reputation: 29912
The problem is that you are trying to upload to a repository group. That wont work. You have to upload to a hosted repository.
Repository groups aggregate proxy and hosted repositories as a virtual merge. If you upload to a hosted repository that is part of the group - the artifact will be available in the group.
Upvotes: 2