4

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?

varesa
  • 2,399
  • 7
  • 26
  • 45

2 Answers2

5

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:

Lonzak
  • 9,334
  • 5
  • 57
  • 88
Stephen Connolly
  • 13,872
  • 6
  • 41
  • 63
1

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.

Andrew
  • 13,757
  • 13
  • 66
  • 84
  • Can you also rename it? My jobs are using maven, but I could set up another job... – varesa Sep 18 '12 at 17:13
  • @varesa That being the case, adding a shell command as a build step to do it would make the most sense to me. – Andrew Sep 18 '12 at 17:23
  • Ok, thanks. I just wanted to know out of interest if there might have been some other way. I guess I'll just make a shell script which finds the latest version, extracts the plain name and copies it. – varesa Sep 18 '12 at 17:34