Eclipse Classpath Task
----------------------
This custom Ant task takes an Eclipse .classpath file and creates
an Ant path-like structure out of it so that you can compile
using Ant or Eclipse, while maintaining the classpath ONLY inside
Eclipse. I wrote this because I like to build my project both ways
and it was getting to be a real pain keeping the two in sync. This
is a one-way extraction: it only goes from Eclipse to Ant, not the
other way around.
To use it, you need the eclipseclasspathtask.jar file and jdom.jar.
The easiest way to install this task is to drop both jars in your
ANT_HOME/lib directory.
On any project where you wish to use the task, you need to add this XML
snippet
If you put the jar somewhere else, you'll need to set a classpath
(funny, isn't it?) to both eclipseclasspathtask.jar and jdom.jar
and reference it on your taskdef line.
Once you've taskdef'ed it, it's ready to go. It has several options,
all of which are optional. If you happen to use Eclipse 3.0 M8 or
later, keep your workspace under C:/Eclipse/.workspace and want
the classpath structure to be called "classpath", then you can
simply add this line
somewhere in your build file. If you'd like more control, here is
a list of options and their defaults:
Option | Required | Default
---------------------------------------------------------------------
dir | No | The currect directory
filename | No | .classpath
pathid | No | classpath
verbose | No | false
workspace | No | c:/eclipse/workspace
So, a fully specified use would be
You will probably never use the "dir" or "filename" options, but
they are there if needed. Here's how you'll probably use it:
I have tested this task with Ant 1.7alpha using projects from Eclipse
3.0 M8, M9 and 2.1.3 on Windows. I have tested with 3.0 M9 on RedHat
Linux 9. If you have problems with this task, please let me know.
Include as much info as possible (OS version, Ant version, Eclipse
version).
Copyright 2004 Joey Gibson
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.