ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jon Stevens <>
Subject Extending path
Date Fri, 04 Jun 2010 18:52:12 GMT
Hi all,

Been a long long time since I've been around these parts, so apologies
if this has been covered before.

What I'd like to do is be able to add a couple of attributes to the
<file> element that lives in a <filelist> and then get access to those
attributes in my Task. I've mucked around for the last couple hours on
seeing how I could extend the existing ant code to make this happen
and it really doesn't seem easily possible.

For example:

    <path id="filelist.classpath">
        <myfilelist dir="${lib.dir}">
            <file name="${ant.jar}" src="thesrc" scope="run" />
            <file name="svntask.jar" src="svntasksrc" scope="compile" />

    <classpath refid="foo" />

Thus, in, I have:

    private List<Path> classpaths = new ArrayList<Path>();

    public void addClasspath(Path classpath) {

This works fine.

However, since there is no way to access the Union within a Path, I'm
kind of stuck cause I can't access the actual myfilelist objects to
get out my additional attributes. I could implement my own Path
object, but that is kind of a pain as I've already had to copy/paste
the source code for FileList.

I guess, ideally, Ant would be a lot more extensible if all of the
private fields had getter/setters and internally those getter/setters
were used instead of direct access. This would allow me to more easily
extend the existing Ant objects.

What I'm trying to accomplish is the ability to define a <path> within
Ant and then be able to pass that to a Task that I wrote that can
generate the Eclipse .classpath and .launch files. The task will be
smart about looking at the scope (run/compile) as well as pointing to
the source for the jar file.



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message