Using sshexec from ANT in Eclipse for build files
Following on from other posts, we continue to improve our build files for deployment of client sites. Our latest addition is the sshexec task for clients using Linux or a LAMP environment to host their site. Our build files move the code out of SVN, zip it up, commit the build record back to SVN, and FTP the resulting file to the site. With ssh we can now unzip the file and have ANT do all the work for us. sshexec is not one of the core tasks in ANT, you can find out about ANT dependacies here. Currently you need jsch.jar 0.1.29 or later from the JCraft Java Secure Channel project.
Place the JAR file into [eclipseroot]\plugins\org.apache.ant_1.7.0.v200803061910\lib directory
Once you have placed your jar file, you need to get Eclipse to load them at runtime. I read somewhere that using the ANT folder above and a simple restart would have Eclipse pick them up, but that didn’t work for me.
- Open Eclipse
- Window > Preferences
- Ant > Runtime
- Ant Home Entries (Default)
- Click Add External JARs
- Navigate to [eclipseroot]\plugins\org.apache.ant_1.7.0.v200803061910\lib or wherever you unzipped the jar files
- Select the jsch.jar file
- Open > Apply > OK
- Restart Eclipse
You should now be able to use the following target to make it happen, this example unzips a predefined zip file: