Reputation: 811
I have setup an environment where all my process of svn checkout/updating, compiling, making war, creating required environment are done using the Ant build.xml
. I am also willing to deploy the built war file through the Ant build.xml
.
I am successful in using the build.xml
to deploy applications on to a Linux machine using the SCP task for deploying into the Tomcat webapps directory with the below code.
<target> <scp trust="true" file="antproject1.war"
todir="${tomcat.username}@${tomcat.server}:${tomcat.webapps.dir}"
password="${tomcat.password}"/> </target>
But I am not aware what task is to be used with what jar files added to the ANT_HOME
, to send the war file from my local machine to the remote Windows machine.
Upvotes: 1
Views: 1347
Reputation: 202721
The SCP is not natively supported by Windows.
You can install a 3rd party SCP server. Though most good and easy-to-install SCP servers are commercial.
Only an FTP (or FTPS) is supported natively, by Windows IIS server in particular.
See my guide for Installing secure FTP server on Windows using IIS.
Once you have an FTP server running, use an Ant FTP task.
<ftp server="example.com" userid="username" password="password">
<fileset dir="path">
<include name="antproject1.war"/>
</fileset>
</ftp>
For more examples, see Ant FTP task documentation.
Though note that the Ant FTP task does not support TLS/SSL encryption unfortunately. So contrary to recommendation in my guide, you have to allow unencrypted connection to the IIS.
If you want to use a secure connection, you have to use an Ant Exec task and run an external FTPS client.
For example with WinSCP:
<exec executable="winscp.com">
<arg value="/command"/>
<arg value="open ftps://username:[email protected]/"/>
<arg value="put c:\localpath\antproject1.war /remote/path/"/>
<arg value="exit"/>
</exec>
For details, see the guide to WinSCP scripting.
Advantage might be that WinSCP supports the SCP (and SFTP) protocol too. So you might have the same code (except for the session URL) both for Linux SCP/SFTP and Windows FTP/FTPS.
(I'm the author of WinSCP)
Upvotes: 3