Antlib taskdef in IDEA

I need to work with .7z files in an Ant build I write and run in IDEA. To do that, I've installed Apache Compress Antlib in Ant's lib directory, and added this to the relevant build target:

<taskdef resource="org/apache/ant/compress/antlib.xml" />

The <sevenz> task I need works fine in the build, but IDEA highlights it and the <taskdef> line above as errors in my build file. Clearly Ant has loaded the library and its taskdefs, but IDEA's parser doesn't see them for some reason.

Is there something I need to do to fix this? Or is it a bug?


Comment actions Permalink

While asking another question about Ant builds in IDEA, I discovered that running the build through IDEA's normal build process fails, not seeing the 7zip library.

I hadn't realized that because I've been running it from IDEA's terminal window, in order to see all the msgs the build echoes out, which IDEA apparently doesn't display.

Upshot seems to be that IDEA and Ant in IDEA don't know about the add-in lib, but Ant itself does.

How can I fix this?

Comment actions Permalink

Figured it out: Added the 3 jars from the Apache Compress Antlib as additional classpaths for the build file. Now the build runs from within IDEA too, and syntax highlighting cleaned up.

I assume this is the right approach, yes?

I'll still be running the build from IDEA's terminal window in order to see all msgs it echoes, something I'd also like to fix, but this seems more correct.

Comment actions Permalink

Hi Dave,

Yes, for reference resulution purposes IDEA tries find classes used by the taskdef in the Ant's classpath. If classes location is mentioned in the build file and/or the taskdef itself, this location is explored too. If no classes location is specified, IDEA tries to resolve against ant libraries, which are associated with the build file,  as well as in the additional classpath, associated with this build file.


Please sign in to leave a comment.