Ant Bugs & Enhancements (As of 5201)

Lots of people use Ant ( to build java projects. For
the projects I work on, the Ant buld.xml is the official document on how the
project is built. We have developers using IntelliJ and Eclipse. We don't use
the IDE's build functions, although we still have to setup the classpath
correctly so that syntax highlighting works, and we have to set the output path
to match the location where ant outputs the files so that we can use the
debugger. I'm sure lots of other companies have a similar setup.

Needless to say, the IDEA Ant integration is very important, just like the VCS
integration. Overall, the Ant integration works well for us, adn I don't have
any real pain points. There are a couple enhancements/fixes I would like,
though, so I thought I would search the Jira database to see what was there.
Well, I was really surprised there was a huge number ( > 200) of unresolved
requests. I had to take a break before I finished wading through all of them.
There were quite a few good ideas, and also alot of unresolved bugs which were
hard for me to see if they were fixed because they involved specific build.xml

But before I get into all the jira requests for Ant, I wanted to share a few
tips in case you didn't know about them.

1) Run Multiple Targets
You can select multiple targets by CTRL+click to select the targets and then
press Run. Note: if you misclick, and have to unselect a wrong target, you
need to clear the selection and start over, because IDEA will reverse the
order of the targets which probably isn't what you wanted.

2) Meta Targets.
After selecting multiple targets with CTRL+click, you can right-click and
select Create Meta Target. You can give it a name, and then it will show up
in the Ant Tool window as a virtual 'meta' target. This meta target gets
saved with your IDEA settings. Note: if you remove the build.xml file from
the Ant Tool window, the meta targets are lost.

3) Execute Targets Before/After
You can select a target, right-click and select 'Execute On'-> ' Before
Compilation" or "After Compilation" or "Before Run/Debug". The "Before Run/
Debug" let's you select specific run/debug configurations that you want the
ant target to be executed before.

Previous Topics:

Find Requests:
JSP Requests:
Inspection UI Requests:

Comment actions Permalink
  • Ability to import the classpath from a <javac> or a <classpath> variable.

Many companies use Ant to build their software; When the build.xml changes,
we currently have to manually update our module/project/global libraries. It would
be nice if there was some way to sync up with classpath defined in the build.xml.
This gets tricky if we want to incrementally pick up changes from the build.xml.

  • Ability to import Run configurations from <java> tasks of an ANT. We also

store in our build.xml various targets for running our applications and tools
from our workspace. If we want to debug an application, we have to manually
recreate the classpath settings, and command line arguments in IDEA Run
configuration dialogs. It would be greate if we could just select a ]]> task
and have IDEA do all the tedious work.

Provide an option to static import an external classpath from an ANT build file (Oliver Pfeiffer)

Comment actions Permalink
  • Would be nice to have a special icon for ANT files. Right now it just shows the XML icon.

New icon for ant files

Comment actions Permalink

Ant Tool Window

  • Should be able to set Global defaults for the Build File Properties like

Make build in background, Maximum heap size, Execution settings, and
Additional Classpath settings. (AlexL, NoJira#)

I'm getting real tired having to check off Make build in background everytime
I add a build.xml file. If nothing else, can you just change the default for
Make build in background to be TRUE! This would help with the effort to banish
all modal/focus-stealing progress dialogs; With the increasing availability of dual-core
workstations, all longrunning tasks should run in the background by default.

  • Need "Autoscroll to source" toolbar icon. If enabled, if you click

on a target, it should jump to the target definition in the build.xml
file. (Alain Ravet)

Ant build panel : add "Autoscroll to source". (Alain Ravet)

  • It would be very useful for us to have the ANT file path (build.xml)

in the Ant Build panel somewhere, either in parenthesis after the
project name as defined in the ANT file or elsewhere. A different
approach would be to allow renaming of project names in the ANT
panel. This would be useful for cases when there are several
versions of the same project thus the project name is the same.
(Amnon I. Govrin)

Make ANT file path visible in Ant Build panel (Amnon I. Govrin)

  • Need to give option to sort targets alphabetically or in file order.

(Originally was displayed in file order, then in 4.5 the order was changed
to alphabetical. For some build.xml files, the file order makes more sense) (Erb)

Cannot sort Ant targets by file order

  • BUG: If you doubleclick on the name of an ant build file in the Ant Build pane,

the build file folder is collapsed/expanded and the default target is executed.
Only one of these should be happening. (Stephen Kelvin)

Double click on ant file (Stephen Kelvin)

  • BUG: You can only Assign Shortcut to a Ant target if you have added it to the fiter targets

in the Ant Build window settings dialog, which is not obvious at all. (Rob Harwood)

Should be allowed to add keyboard shortcuts to any Ant target (Rob Harwood)

  • Currently, we can add a shortcut to a project Ant target, and it

will stay linked to it, even when we change projects. There is a
need to be able to make those shortcuts (Alain Ravet)

  • global (application based) => reuse a key, across project.

Example: same key to call the default or "compile" target.

  • project based/stored.

Example: same key to call a target, with a different name per project.

Ant shortcuts : add option to make them 1/ global, AND 2/ reusable per project (Alain Ravet)

Comment actions Permalink

Messages Window

    • In 4.5, the Ant Build window has an "Autoscroll to source"

toggle button. If enabled, then when the user clicks on a
compile error in the Ant Build message window, IDEA loads
the associated source file into the editor and autoscrolls
to the line number. Likewise, if you click on an ant task
or target name, IDEA will display the build.xml file and
autoscroll to the line number of the task or target.

That worked greatl, but in 5.0, there was a new "feature"
which co-opted the "Autoscroll to source" to have an
additional unwanted effect: When you invoke an ant target
and you have "Autoscroll to source" selected, IDEA will now
automatically load your build.xml and keep auto-scrolling
the editor pane to each target as it is executed.

This is a totally different, and (for me) an unwanted,
annoying feature. It should have a completely different

I have configured my Ant Tool window to compile all ant
targets in the background. In 4.5, while I am compiling,
deploying, etc., I could keep editing in the editor. Now
in 5.0, my editor gets hijacked, my build.xml gets
displayed, and the editor starts jumping all around until
the ant target has completed.

Of course, I could just turn off "Autoscroll to source".
But I really like the original meaning autoscroll to
source when the user clicks a compile error or a ant target
or task name.

I'm not sure if Jetbrains explicitly created this misfeature, or if
somehow the focus is being set in the Ant Messages window as the build
progresses, which triggers the auto-scroll feature.

Either way, it is a big no-no. If the ant build is happening in the
background, it shouldn't be taking control of the editor pane. (AlexL)

ant build window -- 5.0 has annoying misfeature of hijacking my editor pane and animating my build.xml while ant executes.

    • The default output for Ant is too verbose. For example, one of my targets looks like this:


Some ideas are:

1) Only show targets which generated errors, e.g. if you have a target "compile clases"
which has all these tasks , , , etc. and finally a "javac" task, if the ]]> task generates an error, then the tree should look like

compile classes

And all the other tasks shouldn't be shown.

2) Maybe just let the user's list which tasks to show or which not to show,e.g.
don't show: "property, condition, fail, path, patternset, fileset,etc."

Workaround: You can add "-quiet" to your ant commandline arguments in the build.xml IDEA properties
dialog. But.. this eliminates all output except for the errors. You don't see any tree at all, so
it is a little too extreme.

Ant build messages: Provide option to show only errors and warnings (Gordon Tyler)

Ant integration: Hide empty nodes + Text view like Ant's default logger

  • A very useful feature in 4.x was the ability to browse to ant source

code from messages view, e.g. when a build fails. Right click on a
target node gives the option "Jump to source" . This option is not
present in 5.0, which I believe is a bug. It works fine in 4.5.4
Workaround: Select target and press F4. Or turn on the 'Auto-scroll to
source' toolbar button. (But see problem above with auto-scroll to
source.) But a Context menu is better because it allows you to discover
the features. The context menu should also show the shortcut F4.

Jump to ant target broken in 5 (Gudlaugur Stefan Egilsson)

Comment actions Permalink

Editing Ant build.xml files

    • Currently "}" interrupts the property autocompletion.

It's not consistent with the code autocompletion where ")", "=", etc. insert the selected entry.

Autocomplete Ant property names on "}" (Inconsitent with Java completion)

    • IDEA should recognize if non-existing ids are referenced. For exmaple:

Support for other id-references in standard tasks, like ]]> would be great too.

Ant support should know about id/refid attributes

    • CTRL+W in ant build.xml should be aware of variable syntax. For example,

<property name="INSTALL_REMOTE_DIR" value="$/install_remote"/> If I put my cursor on BUILD, when I hit CTRL+W successive times, it will select BUILD, BUILD_DIR, $/install_remote

It would be nice if it selected the variable $ before that last step.

Ctrl-W in ant build.xml (Victor Grazi)

  • If you have <property file=""/> and "" doesn't exist,

IDEA should offer an Intention to create the file ""

new intention in Ant files: create (properties) file, if it does not exist yet.

    • Ant should have action in context menu and/or a keyboard shortcut to run the ant target

at caret.

Run ant target at caret (Jacques Morel)

Ctrl-Shift-F10 in ant build file should run target (Vincent Mallet)

Comment actions Permalink

Find in Ant build.xml files

  • Suppose I want to find all of the places that property "some.dir" is used:

I would like to be able to use Find Usages (Alt-F7 or from context menu)
on "some.dir", and it would list all places where it is used like this: ${
some.dir} This would be better than doing a text search, because it might
be across multiple files and some files might by referring to a different
property with the same name, which I don't want to turn up in the Find
Usages results.

Find Usages on an Ant property

Find usages of Ant task

Comment actions Permalink

Run Ant Target

    • After running every target from the Ant Tools window, IDEA synchronizes the workspace.

This is a pain in the @#$% because (1) it takes about 6 or 7 seconds for the synchronize to happen
and (2) while the synchronize is happening I can't work in my editor. So, even though I can run the
Ant target in the background, I know that when it finishes I am going to be locked out of the editor
for 6 to 7 seconds. (3) Most of the time I don't need the files to be synchronized because I don't
use IDEA to build or run my application and I don't do anything strange like generate source files
from my Ant build. (Eran Leshem,AlexL)

Please Jetbrains, make this configurable.

File synchronization after ant build can't be disabled (Eran Leshem)

  • Bug in IDEA's implementation of <exec> task

Follow script execute notepad but it not forced to wait end of executon of notepad.

If you run this one from command line, ANT will continue executing and finished SUCCESS, but if it runned from IDEA, IDEA will wait on task exec until i'll closed notepad.

IDEA hold Ant task event process is not owned

Comment actions Permalink

Execute On

  • Execute On doesn't work with Meta Targets

Execute before/after for ant meta targets (Sebastian Graca)

  • Allow Execute On->After Run/Debug. IDEA supports Execute On->Before Run/Debug, but there are

cases where I would like to run an ant target After Run/Debug.

Ant target : .[run AFTER run/debug]

  • Allow conditional Execute On Before/After Compilation

Eclipse has a nice feature where you can conditionally execute a given
Ant target before a build if and only if any files under a certain
directory have changed. This would be usefull in my particular case
where I have a directory hierarchy that holds XML files, and an Ant
target that generates Java source from those XML files. I currently have
IDEA setup to execute the Ant code generation target before each build,
but this wastes time in the case where none of the XML source files have
changed (the code that generates Java from XML is smart enough not to
regenerate code if the XML source hasn't changed, but still it has to
compare the timestamps on hundreds of XML files versus their Java

Provide ability to specify condition when running ant targets before compilation...

  • Sometimes it is convenient to make IDEA project before or after running

particular Ant target (e.g. if this Ant target generates Java code it
will be nice to compile the generated code); it is also good option when
your project has many Ant scripts and you want to avoid running all of
them each time you build your IDEA project. So I propose to add an
option to popup menu in Ant script target:

"Make project" with sub-menues:
"Before execution" and "After execution"

Add options for Ant script execution: "Make project" "Before and efter execution"

  • IDEA 5.0: Ant "after compilation" runs after J2EE EAR build

In IDEA 4.5, enabling "after compilation" on an ant target makes it run
after compilation, but before a J2EE modules EAR file is built. This
allows enhancing classes for JDO, building an extra jar to include etc. In
IDEA 5.0, the ant target runs after the J2EE build which makes little

  • Allow Execute On->Before Rebuild. There are certain tasks, e.g. special clean, that I would like

to do only before a Rebuild, not a regular build.

ant: support for ant target execution w/project rebuild

Comment actions Permalink

Resolving Properties

There are all kinds of problems with with resolving properties in build.xml files. This is one area where IDEA's Ant support needs alot of improvement.

    • IDEA can't find properties read from file in imported Ant build file* (Francis Devereux)
Here is an example:



    • Ant: exec task's resultproperty attribute is not properly supported* (Gordon Tyler)

For example:


autoconf.return.code in the condition task is marked as unresolvable.

**Ant: java task's resultproperty attribute is not properly supported* (Gordon Tyler)


In the condition task, the java-unit-test-result property is marked as unresolvable even though it was defined in the java task previously.

  • * in-file expanded ant properties not recognized* (Edwin van Ouwerkerk Moria)

This is a very big issue because the problem is making all of our build files
very hard to edit and use within IDEA.

partial build.xml

The ${tomcat.anttask.jar} property is red. Running the build (inside IDEA, and command line) does works correctly, however.

    • ant: property defined using <loadfile> not recognised* (Chris Sherratt)

A property defined by the ]]> task is not recognised by the ant
editor - it is highlighted in red whenever it is referred to.


    • If you set a property using the <basename> task, IDEA doesn't recognize that it has been set, and flags subsequent references to that property in red, with a "Can't resolve property" error.*

takes a 'property' attribute, and sets the named property to the unqualified name of the ' file' attribute's value. (Igor Kuralenok) Ant integration doesn't register property set by ]]> task.

***Bad ANT build.xml highlighting for conditional properties* (AlexL,Peter Lawrey,et al)

There are cases that IDEA shouldn't highlight a property as undefined if there is
a check to see if the variable is defined before using it. At least, the error should
be changed to a warning.

Example 1:

A property LIB_DIR is based on WEB_ROOT property if WEB_ROOT is set,
otherwise it defaults to another value.
PROBLEM: WEB_ROOT is highlighted as undefined property, even though it is only used
if it is defined.

<condition property="LIB_DIR" value="$/lib">
Example 2: This target requires that three properties be set before it is called. PROBLEM: the ${src-dir}, ${class-dir} are highlighted as red even though ANT will not execute the targets where they are accessed unless they are defined. ]]>

**Ant 'import file' doesn't work if file location is defined via properties from the .properties file* (Serge Baranov)



      • IDEA only resolves property files which have a file extension of type property.*

This is a @#$% because Ant allows property files ot have any extension,
e. g. .txt or no extension at all. Jetbrains said they wouldn't fix
this because it doesn't fit in with there ]]>

IDEA relies on this mapping for Properties Files referenced from Ant. It
is AFAIK perfectly legal to name such files other than .properties to
make them work with Ant and IDEA shouldn't impose such a restriction.

This can cause alot of pain for people that already have a large Ant
configuration if they are forced to rename their property files to .
properties extension. I recommend Jetbrains fix their design to allow
ant property files to have any extension.

WONT FIX Regression from 4.5.x : Ant build.xml doesn't resolve properties set in an included property file. (AlexL)

    • Configurable "Can't resolve property" Ant errors*

Please add the ability to configure "Can't resolve property" Ant errors.
Like for Java errors/warnings: "As errors", "As warnings", "Do not show".
If available, I'd set it to "Do not show" for some of our projects. For
example, you want always to supply the property value at the run-time "
ant -Dport=1234".


Even better: allow the user to decide whether the name should be flagged on a case-by-case basis.

Comment actions Permalink

Target Names

  • * IDEA doesn't like ANT target names that are partly a variable:* (Serge Baranov)


In Ant build.xml target names that are partly variables not recognized, even
though they work fine when the target is run.

Comment actions Permalink


Add Ant inspection to detect duplicate targets (Vincent Mallet)

Comment actions Permalink

Here is another Jira request related to importing classpath / run configuration from our ant build.xml files:

  • Ant integration: option to use settings from Ant build file*

Comment actions Permalink

Ant Configuration

  • relative ant project definition (Peter Morelli)

I'd like to be able to define a custom ant location (which you can do
now), but have it be relative to the project directory, similar to paths
and libraries. It seems to be stored with an absolute path (in config\
options\ other.xml), with no way to make it relative.

It would be nice to store it as part of the project, in a relative
fashion, so that it's possible to share preconfigured ipr files with
team members, but still use our customized ant distro.

  • Make it easier to include the optional libs in ant. (Kevin Lawrence)

Perhaps include them by default or add a checkbox to include them all.
It's frustrating to get the "can't find junit blah blah" message from
ant everytime I add a build.xml to the ant view and to then have to go
search for the junit.jar and ant-junit.jar.

Workaround (AlexL) : I agree this is annoying. You should be able to set
a default for all ANT build.xml files.

Workaround is to install ANT on your machine, and then set the Project
Default Ant to your external version of ANT rather than the bundled ANT.

Then, you copy all the required 3rd party jarfiles into $/lib
and restart IDEA. Now ANT will know about all those 3rd party jarfiles
without having to configure anything in IDEA.

  • * Add Global/Project Libraries in additional ant classpath*

Please implement an option to add project or global libraries to the
additional ant classpath. Would be useful if adding the file directly
won' t work when sharing project files between Windows and Linux/Unix
workstations for example.
also related
Missing "Include project classpath" checkbox in Ant Build props

Comment actions Permalink

Support for Advanced Ant Constructs

It seems that if you start using advanced constructs of Ant, that's where
IDEA's Ant support may not be up to the task. Demetra's focus is supposed to
be on TEAMWARE. Well, people working on big teams on big projects usually have
big ant build.xml configurations which often use these advanced contstructs
like imported build.xml files, custom tasks, scriptdefs, macrodefs, namespaces,

Note: A few of these I couldn't verify in 5201 myself, e.g. Chinese output.

Allow namespaces in Ant files

Support ant.file. for ant imported files Ant import with another import in imported file confuses IDEA (Martin Saxer) ANT - XML editor starts chewing 50% of CPU and hilights incorrect errors. (Mike Wannamaker) chinese info can not be displayed in ant build output messages panel Ant 1.6.1 features not recognized. ant build.xml cannot resolve target in depends="...." when target name contains spaces (AlexL) Ant displaying errors when using custom task ant tasks created via "scriptdef" are not recognized by idea ant editor \ Adding extra namespace to ant build.xml file confuses IDEA Ant's typedef task not properly supported Ant editor incorrectly resolves import task file attribute relative to project basedir Ant integration: "unresolved symbols" in imported files (This is similar to JSP fragment problem) Adding xmlns attributes to the ]]> tag causes ant build files to be treated as normal xml files

ant.home property not available inside the ant editor

Comment actions Permalink

During my survey of the IDEA Feedback Swamp and the IDEA Backlog Dump, I found these bugs were Fixed. Close 'em

  • Fixed *


"quick doc" for ant tasks (Igor Karpov)

ANT target name containing spaces causes "cannot resolve symbol" red error bar in editor.

Ctrl-W enhancement in Ant

Add intention to create missed property in Ant scripts

Ant properties enhancements

"ant" ant task shows errors incorrectly when using a property for the "dir" attribute

Ant editor should support renaming properties defined in property file
Ant editor should support renaming properties defined in property file

Support file entity references (includes) in ant build files correctly

Ant editor: Navigate to definition of properties defined in property file

Editor doesn't use Ant properties file

On Idea 5.0, Ant exits with a success message without actually running the selected target...

Ant tree does not show targets from imported projects

Comment actions Permalink

Bugs Without Any Steps/Not Reproducible. Close 'em

ANT XML editor bug

Infinite loop and hang when editing ant xml file

ANT build file with ]]>

Comment actions Permalink

Eclipse has the ability to create a new project from an Ant build.xml file.
Here are the steps for Eclipse:

To create a project from an existing ANT buildfile:

1. Click on File->New->Project
2. Select "Java Project from existing Ant Buildfile" and click "next".
3. Enter a project name, and select the build file to use to create the project.
4. Select the javac declaration to be used to define the project.
5. Click "finish".

Has anyone done this? I wonder how well it works.
This is definitely useful to get someone up and running with eclipse very quickly if their project is defined with ant build.xml files.
Although, it still doesn't help with the ongoing updates made to the build.xml afterwards.

The ultimate would be for IDEA to remember which ]]> task goes with which project/module, and then which it changes, to prompt me to update IDEA's classpath for that project/module. Even if the user has to manually initiate the check that would be ok.

Comment actions Permalink

Ant Debugger

For people that are writing custom Ant tasks, there is a need to be able to debug the execution of your build.xml files. IDEA doesn't have an explicit ant debugging support. Is there some way to at least set breakpoints in your custom java tasks if not in your build.xml file?

add ability to debug ant targets

Breakpoints in Ant builds

In Eclipse 3.1, they added an Ant Debugger. The new Ant debugger helps you
debug the execution of your Ant buildfiles. It includes the standard debugger
features like breakpoints, stepping, dependency call stack, and run-to-line
support. (See attached screenshot)

The presentation of Ant properties are also grouped in the Variables view for your convenience:

  • System: Ant properties set from the System for the the build

  • User: properties such as those set using the -D option

  • Runtime: all properties set during the execution of the build

Comment actions Permalink

Of all the requests listed, the following are the ones I would most like to see
implemented in Demetra. The more stars (***) the more I like it.

Ant Tool Window

    • Should be able to set Global defaults for the Build File Properties like

Make build in background, Maximum heap size, Execution settings, and
Additional Classpath settings. (No Jira#)
(Simple fix: Make build in the background the default!)

  • Option to display targets in file order.

Run Ant Target

      • After running every target from the Ant Tools window, IDEA synchronizes the

workspace. Please make this configurable, since my workflow doesn't require
synchronization. I use ant targets to build and deploy my application. The only
time I would need to synchronize IDEA is if I wanted to debug my app.

Ant - Messages Widnow

    • ant build window -- 5.0 has annoying misfeature of hijacking my editor pane and animating my build.xml while ant executes.

  • The default output for Ant is too verbose. Maybe only show targets which generate errors

or let users specify which tasks to filter out, e.g. "property, condition, fail, path, etc."

Editing Ant build.xml files

    • Currently "}" interrupts the property autocompletion.

It's not consistent with the code autocompletion where ")", "=", etc. insert the selected entry.

  • IDEA should recognize if non-existing ids are referenced. For exmaple:

Support for other id-references in standard tasks, like ]]>
would be great too. But.. if this is implemented, there will be false positives similar
to the 'Unresolved Property.'

Ant support should know about id/refid attributes


There are so many cases where the properties are handled incorrectly.
This is the biggest source of red errors in my build.xml files.
It is hard to single any one out, so I've listed them all.

I will say that conditional properties create alot of red in my build.xml.
If IDEA understands and ]]> logic, they should be able to
avoid marking these as red if the line which accesses the property
can only be executed if the property exists.
A lesser alternative would be allow the user to suppress each instance
by placing @suppress comment in the build.xml.

  • Resolve properties read from file in an imported Ant build file.


*Ant: exec task's resultproperty attribute is not properly supported

*Ant: java task's resultproperty attribute is not properly supported

  • in-file expanded ant properties not recognized


  • ant: property defined using <loadfile> not recognised


  • If you set a property using the <basename> task, IDEA doesn't recognize that

it has been set, and flags subsequent references to that property in red, with
a "Can't resolve property" error.

**Bad ANT build.xml highlighting for conditional properties

*Ant 'import file' doesn't work if file location is defined via properties from the .properties file

  • IDEA only resolves property files which have a file extension of type property.


  • Configurable "Can't resolve property" Ant errors


Target Names

  • IDEA doesn't like ANT target names that are partly a variable



Please sign in to leave a comment.