Jenkins,Maven,Nexus - 将第三方JAR部署到需要身份验证的Nexus

时间:2016-03-12 21:38:39

标签: java git maven jenkins nexus

我正在尝试设置Jenkins CI服务器,以便在完成构建后自动部署到Nexus服务器。我的问题是,因为Nexus存储库受密码保护,而且JAR文件来自第三方(pom.xml文件的存储库未正确设置)。我正在使用的当前命令如下:

mvn deploy:deploy-file -Dpackaging=jar -DrepositoryId=nexus -Durl=http://nexus.<redacted>.com/content/repositories/releases -DpomFile=Spigot/Spigot-Server/pom.xml -Dfile=Spigot/Spigot-Server/target/spigot-1.9-R0.1-SNAPSHOT.jar

我也不太确定这是否是一个问题,但由于最近的法律问题,Spigot(Minecraft服务器)要求它通过“修补”生成的JAR文件的“BuildTools”应用程序运行,所以我无法直接从git存储库中克隆。

我现在有点难过,所以我很感激你能给我的任何帮助。谢谢!

编辑:我忘了包含我得到的错误:

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error deploying artifact: Failed to transfer file: http://nexus.<redacted>.com/content/repositories/releases/org/spigotmc/spigot/1.9-R0.1-SNAPSHOT/spigot-1.9-R0.1-20160312.214547-1.jar. Return code is: 400

1 个答案:

答案 0 :(得分:0)

事实证明,由于我发布到发布存储库而不是快照存储库,因此Nexus拒绝构建:

Storing of item releases:/org/spigotmc/spigot/1.9-R0.1-SNAPSHOT/spigot-1.9-R0.1-20160312.214547-1.jar is forbidden by Maven Repository policy. Because releases is a RELEASE repository

我只是将命令更改为:

mvn deploy:deploy-file -Dpackaging=jar -DrepositoryId=nexus -Durl=http://nexus.<redacted>.com/content/repositories/snapshots -DpomFile=Spigot/Spigot-Server/pom.xml -Dfile=Spigot/Spigot-Server/target/spigot-1.9-R0.1-SNAPSHOT.jar

它似乎正在发挥作用。