如果我尝试使用命令
上传jarmvn 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
我收到错误
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描述了如何在settings.xml中配置Nexus存储库
<mirror>
<id>nexus</id>
<url>http://2.23.45.65:8081/nexus/content/repositories/central/</url>
<mirrorOf>central</mirrorOf>
</mirror>
此外,我尝试配置组/公共存储库。 在settings.xml中
<server>
<id>nexus_public</id>
<username>username</username>
<password>passwd</password>
<filePermissions>664</filePermissions>
<directoryPermissions>775</directoryPermissions>
<configuration></configuration>
</server>
在pom.xml中
<repositories>
<repository>
<id>nexus_public</id>
<url>http://2.23.45.65:8081/nexus/content/groups/public/</url>
</repository>
</repositories>
尝试运行命令
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
但我得到同样的错误。
此外,我尝试按照本文所述找到“组件上载”选项卡 https://books.sonatype.com/nexus-book/reference/using-sect-uploading.html
但我在Nexus Repository Manager OSS中找不到此选项卡。 这应该在选项卡摘要之后,但它不存在。
答案 0 :(得分:2)
问题是您正在尝试上传到存储库组。那不行。您必须上传到托管存储库。
存储库组将代理和托管存储库聚合为虚拟合并。如果您上传到属于该组的托管存储库 - 该工件将在该组中可用。
答案 1 :(得分:1)
-DrepositoryId=nexus
这是错误的,您需要在settings.xml文件中使用具有登录凭据的服务器部分的ID。
尝试使用:
-DrepositoryId=nexus_public
另外,我无法说出什么样的存储库&#34; central&#34;来自您的命令,但默认情况下,Nexus附带一个名为&#34; central&#34;的代理存储库。您无法上传到代理或组存储库,只能上传到托管存储库。