Free Eclipse Classpath Ant Task

This software is no longer supported! I have neither used nor updated this software since I originally posted it, back in 2004. You are welcome to both the binary and source versions, but I no longer do anything with it or support it. If you need something changed, you will have to do it yourself, using the source. Sorry, but after I released it, I realized how little I really needed it, and thus stopped using it.

I’ve just released version 1.0 of a free Ant custom task to make it a little easier to work on a project using both Ant and Eclipse. What this task does is read the .classpath file that Eclipse uses to maintain your project’s classpath, combines that with your Eclipse preferences to expand classpath variables and then creates a path-like structure in your Ant project that you can compile against.

I wrote this because I use Eclipse and I always also have a build file. Keeping the two in sync, classpath-wise, was always a hassle. Now I can simply update the classpath inside Eclipse, and whenever I do an Ant build it will automatically be in sync.

I wrote it against Eclipse 3.0 M8 originally. Then I upgraded to M9 and it stopped working. So with a bit of futzing about, I got it to work with both 3.0 versions and 2.1.3, all three of which keep the preferences file in completely different places with completely different names. But that’s taken care of now. I have also tested on both WindowsXP and Linux, but more on XP than Linux.

To use it, drop the jar file (plus jdom.jar if you don’t already have it) in ANT_HOME/lib. Then taskdef the task

  <taskdef resource="com/joeygibson/ant/eclipseclasspath.properties"/>  

Then call the task. There are several optional attributes, but if you want the classpath to end up in a path called “classpath”, then you can probably get by with just this

  <eclipsecp workspace="/home/me/workspace"/>  

If you are on Windows, and using Eclipse 3.0 M8 or later and you keep your workspace in C:/Eclipse/workspace then you don’t even have to do that much. You can get by with

  <eclipsecp/>   

Once you’ve executed the task, just reference the newly-created path from your javac task or anything else that takes a path as an argument.

You can read more about it in the README.txt

I’ve got several downloadable versions available, in both zip and tar.gz formats, with and without source, and with and without jdom.jar. If you use it and like it/don’t like it/have suggestions, please let me know.

Downloads
Binary only ect.zip
ect.tar.gz
Binary w/ JDOM ect-with-jdom.zip
ect-with-jdom.tar.gz
Source only ect-src.zip
ect-src.tar.gz

I’ve heard there are other tools out there that do this, but I didn’t find them, so I wrote my own. Please email me with any comments you have about it.

Ant Talk At CJUG

I want to thank the folks at CJUG for having me up last night to speak on Ant. I thought the talk went well, though I did run long. I must say it’s rather embarrassing to discover that your presentation, which is supposed to fit in about an hour and a half, in reality needs three hours to be done right… I need to pare it down so this doesn’t happen again. Those in attendance didn’t seem to mind too much, and everyone stuck around a bit longer than planned, which was nice to see.

What I’d really like to do is to extract a subset of the slides into a smaller presentation, yet still have them linked so that I would only have to revise the slides in one PowerPoint file instead of two. Does anyone know if that’s possible?