Question

I have a maven project for which I want to move the war file created by jenkins to a remote jetty server using sftp/ssh connection.

Could anyone suggest how to do it as I am naive to jetty and jenkins.

Thanks in advance

No correct solution

OTHER TIPS

You can add a job to Jenkins that executes a certain shell command; so just add a new job with the command you would use to transfer the file manually and set the job to depend on your exiting build job that generates the WAR, so that it runs after the buld automatically (alternatively: configure it as a post-build action on your existing job).

I needed to do something similar but the other way around. I wanted to download a folder from a sftp server to my local machine. Ended up writing some python and using pysftp to solve it.

Basically you just use the sftp put function.

sftp.cd('whatever')              # temporarily chdir
sftp.put('/my/local/filename')  # upload file to public/ on remote

Perhaphs you will find my code useful (which is doing the reverse that is downloading a folder): http://sebastiannilsson.com/en/blogg/python-for-sftp-and-mysql-backup/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top