简体   繁体   English

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

[英]Jenkins, Maven, Nexus - Deploy 3rd Party JAR to Nexus Where Authentication is Needed

I'm trying to set up a Jenkins CI server to automatically deploy to a Nexus server after it finishes building. 我正在尝试设置Jenkins CI服务器,以便在完成构建后自动部署到Nexus服务器。 My issue is that since the Nexus repository is both password protected and the fact that the JAR file is from a third party (the pom.xml file's repository is not set up correctly). 我的问题是,由于Nexus存储库既受密码保护,又存在JAR文件来自第三方的事实(未正确设置pom.xml文件的存储库)。 The current command I am using is as follows: 我正在使用的当前命令如下:

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

I'm also not too sure if this is an issue, but due to recent legal issues, Spigot (the Minecraft server) requires that it be run through a "BuildTools" application that "patches" the resulting JAR file, so I can't directly clone from a git repository. 我也不太确定这是否是一个问题,但由于最近的法律问题,Spigot(Minecraft服务器)要求它通过“修补”生成的JAR文件的“BuildTools”应用程序运行,所以我可以' t直接从git仓库克隆。

I'm a bit stumped at this point, so I'd appreciate any help you can give me. 我在这一点上有点难过,所以我很感激你能给我的任何帮助。 Thank you! 谢谢!

EDIT: I forgot to include the error I get: 编辑:我忘了包含我得到的错误:

[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

Turns out that since I was posting to a release repository rather than a snapshot repository, Nexus was rejecting the build: 事实证明,由于我发布到发布存储库而不是快照存储库,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

I simply changed the command to: 我只是将命令更改为:

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

And it appears to be working. 而且似乎有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM