How to override ant task stored in ant lib directory

Posted by mchr on Stack Overflow See other posts from Stack Overflow or by mchr
Published on 2010-05-13T09:41:43Z Indexed on 2010/05/13 9:44 UTC
Read the original article Hit count: 565

Filed under:
|
|
|

At my work we use AspectJ in some of our Java projects. To get this to work with ant builds we have been placing aspectjtools.jar within ant/lib/.

I am now working on a particular Java project and need to use a newer version of aspectJ. I don't want to have to get everyone who uses the project to update their local copy of aspectjtools.jar. Instead, I tried adding the newer aspectjtools.jar to the lib directory of the project and adding the following line to build.xml.

  <taskdef
     resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties"
     classpath="./lib/aspectjtools.jar" />

However, this doesn't work as I hoped as the ANT classloader loads jars from ant/lib/ in preference to the jar I specify in the taskdef classpath.

Is there any way to force ant to pick the jar checked into my project instead?

© Stack Overflow or respective owner

Related posts about ant

Related posts about aspectj