java 将工件从 jenkins 复制到另一个具有新名称的服务器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12480603/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Copy an artifact from jenkins to another server with new name
提问by varesa
I have a few jobs that automatically build a java app. I would like it to automatically push it to a other server. I found a plugin that copies artifacts over ssh, but using it I end up with app-1.0-SNAPHSHOT.jar, app-1.1-SNAPHSHOT.jar and so on on the remote server.
我有一些自动构建 Java 应用程序的工作。我希望它自动将其推送到其他服务器。我找到了一个通过 ssh 复制工件的插件,但使用它我最终在远程服务器上得到 app-1.0-SNAPHSHOT.jar、app-1.1-SNAPHSHOT.jar 等等。
I would like to have it as app.jar instead, overwriting the old one every time. Is there a "intelligent" way of doing this, or should I just make a shell script that looks for the newest one, and overwrites it?
我想把它作为 app.jar 代替,每次都覆盖旧的。有没有一种“智能”的方式来做到这一点,或者我应该制作一个shell脚本来寻找最新的并覆盖它?
采纳答案by Stephen Connolly
If you are using a Maven project I would recommend Mojo's Ship Maven Pluginfor doing the transfer via your build scripts.
如果您使用的是 Maven 项目,我会推荐Mojo 的 Ship Maven Plugin通过您的构建脚本进行传输。
If you want to do this via Jenkins plugins, there are the following plugin options:
如果您想通过 Jenkins 插件执行此操作,则有以下插件选项:
回答by Andrew
I just do it right in my build scripts. Why all the extra management? In ant,
我只是在我的构建脚本中做对了。为什么要进行额外的管理?在蚂蚁中,
<copy todir="${remote}">
<globmapper from="*" to="app.jar"/>
...
</copy>
works perfectly fine.
工作得很好。