SCP files to a server using ANT

This is quite easy using the optional ‘scp’ task.

Under windows, this depends on a java implementation of ssh which is found here

Then do something like the following:

<!-- On windows, this needs an optional java implementation of ssh which you can get from :
	 http://www.jcraft.com/jsch/index.html
	 download it, build it and then pop the jar file into your ant lib folder 
-->
<target name="deploy" description="pushes jar to the test server">
    <scp trust="true" file="${target.dist.jarfile}"
    todir="${deploy.server.1.username}:${deploy.server.1.password}@${deploy.server.1}:${deploy.server.1.dir}"/>    
</target>
Share