Copy an artifact from jenkins to another server with new name
-
02-07-2021 - |
문제
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.
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?
해결책
If you are using a Maven project I would recommend Mojo's Ship Maven Plugin for doing the transfer via your build scripts.
If you want to do this via Jenkins plugins, there are the following plugin options:
다른 팁
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.