Using the Ant FTP Task in Eclipse
And here is another joy of ANT – you can move files by FTP. Its not one of the core tasks in ANT, so you can be forgiven for trying it, and it not working. Go check out the ANT Manual FTP Task page and it tells you the components you require.
The Commons is a Jakarta subproject focused on all aspects of reusable Java components. At the time of writing I used the 1.4.1 from Jakarta,. Now you also need the ORO: The Jakarta-ORO Java classes are a set of text-processing Java classes that provide Perl5 compatible regular expressions, AWK-like regular expressions, glob expressions, and utility classes for performing substitutions, splits, filtering filenames, etc. I used 2.0.8. Now open up both of these zip files and you will find some jar files. In order to run these from within Eclipse you should drop them somewhere sensible. I figure that the workspace folder would be good so I moved
into my c:\development\workspace folder. Of course if you would like it to be available across workspaces you could use the ANT folder in
Once you have placed your jar files, 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 c:\development\workspace or wherever you unzipped the jar files
- Select the 2 .jar files
- Open > Apply > OK
- Restart Eclipse
You should now be able to use the following to make it happen, this example sends the contents of the c:/temp directory: