How to emulate "-lib foo.jar" from _within_ build.xml

Posted by Thorbjørn Ravn Andersen on Stack Overflow See other posts from Stack Overflow or by Thorbjørn Ravn Andersen
Published on 2010-03-03T09:11:09Z Indexed on 2010/04/13 22:33 UTC
Read the original article Hit count: 385

Filed under:
|
|

By specifying "-lib foo.jar" to ant I get the behaviour that the classes in foo.jar is added to the ant classloader and are available for various tasks taking a class name argument.

I'd like to be able to specify the same behaviour but only from inside build.xml (so we can do this on a vanilla ant).

For taskdefs we have functioning code looking like:

<taskdef resource="net/sf/antcontrib/antlib.xml" description="for/foreach tasks">
    <classpath>
        <pathelement location="${active.workspace}/ant-contrib-1.X/lib/ant-contrib.jar" />
    </classpath>
</taskdef>

where the definition is completely provided from the ant-contrib.jar listed.

What is the equivalent mechanism for the "global" ant classpath?

(I have thought out that this is the way to get <javac> use ecj-3.5.jar to compile with on a JRE - http://stackoverflow.com/questions/2364006/specifying-the-eclipse-compiler-completely-from-within-build-xml - in a way compatible with ant 1.7. Better suggestions are welcome :)


EDIT: It appears that the about-to-be-released version 1.0 of ant4eclipse includes ecj. This does not answer the question, but may solve my basic problem.

© Stack Overflow or respective owner

Related posts about ant

Related posts about java