IDEA Ant Tool Annoyances

The Ant Tool window has really been bugging me. The Ant integration was so much simpler for me with XEmacs.

Build Environment: We have a build.xml file in each package directory, and also at the toplevel. We can build a single package, or the entire product.

How I used Ant in XEmacs: I would invoke ESC-x compile[RET], and run "ant -find build.xml compile" The command would automatically default to the current package directory I was working in. Errors would get printed in the compile message window and I could use keybindings to goto the errors in the java files.

IntelliJ IDEA: There is no way to invoke the build.xml for the package that the currently edited file belongs to. In order to compile a single package, I need to add that build.xml to the Ant Tool window. After invoking 'compile' target, the errors are displayed in the window at the bottom and I can goto next/previous error.

PROBLEMS IN IDEA ANT TOOL:
1) For build environments where there is a build.xml in each package, it is annoying to have to add each build.xml file to the Ant Tool window.

I would rather have the Ant Tool window monitor the editor window, similar to auto-scroll feature. When the editor changes to a differnet file, the Ant Tool window should determine which build.xml is applicable for that file, and automatically add it to the top of the Ant Tool window. THe algorithm should be the same that "ant -find build.xml" uses.

2) I noticed during a long compilation, if there were errors getting printed out, and I tried to look at them, IDEA would keep reseting the the current error to the last error in the message window each time more output was added. This made it very difficult to look at the errors while the compilation was happening.

In XEmacs, if I started going through the errors while compilation was happening, XEmacs would stop auto-scrolling the buffer.

3) The Ant output needs a QUIET option. I don't want to see every target getting printed out on the screen!. I have 'verbose' icon turned off, and I switched to text output rather than tree, but even then it is ridiculous. See below for the output for one package being compiled.

Ideally, I don't want IDEA to output anything. Our build.xml files automatically print out the info we want to see. For each package we output "SUBPROJECT: package".


SUBPROJECT: ipc.proxy
property
ant
init
property
condition
condition
property
property
property
property
property
property
property
property
property
property
property
property
property
property
condition
condition
property
property
property
property
property
property
property
compile
available
available
condition
antcall
createDirectories
mkdir
antcall
compileJavac
javac

4) I would like to set defaults for the 'Build File Properties' settings. Since I am constantly adding/removing build.xml files to the Ant Tool Window, I have to keep editing the properties, e.g. set maximum heap size, turn on make build in background.

5) I would like to be able to use any version of ANT. Is this possible? I would like to be able to configure which ANT to use similar to how we configure which JDK we use.

One annoying thing was that I had to add 'additional classpath' to the build file properties to add the netcomponents.jar file in order for ]]> tasks to work. If IDEA coud just use my existing ANT 1.5.3 install, then this shouldn't be necessary since the netcomponents.jar is already in the ANT/lib directory.

9 comments
Comment actions Permalink

PROBLEMS IN IDEA ANT TOOL:
1) For build environments where there is a build.xml in each package, it

is annoying to have to add each build.xml file to the Ant Tool window.

One build.xml per package??? I'm much too lazy to mantain all those build
files ;)

2) I noticed during a long compilation, if there were errors getting

printed out, and I tried to look at them, IDEA would keep reseting the the
current error to the last error in the message window each time more output
was added. This made it very difficult to look at the errors while the
compilation was happening.

There's a "Pause output" button in the ant build panel. If it doesn't work,
submit a bug request for this at http://www.intellij.net/tracker/idea/browse

3) The Ant output needs a QUIET option. I don't want to see every target

getting printed out on the screen!. I have 'verbose' icon turned off, and I
switched to text output rather than tree, but even then it is ridiculous.
See below for the output for one package being compiled.

Submit a "really quiet" ant feature request for this :)

5) I would like to be able to use any version of ANT. Is this possible?

I would like to be able to configure which ANT to use similar to how we
configure which JDK we use.
>

One annoying thing was that I had to add 'additional classpath' to the

build file properties to add the netcomponents.jar file in order for ]]>
tasks to work. If IDEA coud just use my existing ANT 1.5.3 install, then
this shouldn't be necessary since the netcomponents.jar is already in the
ANT/lib directory.

http://www.intellij.net/tracker/idea/viewSCR?publicId=11009

It seems that putting your ant.jar and other jar files in the idea.lib dir
is a workaround for this.


0
Comment actions Permalink

You make a couple of good points, but overall it sounds like you're
suffering because you're trying to use Ant in the same way as you would have
used Makefiles. You might be able to simplify things for yourself by making
better use of Ant's features. For example, you can created parameterised
build targets. You could have a single build file at the top level of your
project with a parameterised target for compilation; then you could have a
number of other very simple targets which call it, passing in the name of
the package(s) to compile. Having a single build file would save you the
hassle of adding multiple files to the Ant window and would also mean you
only had to set properties in one place.

You're right about being able to set default properties for build files
though: that would be nice. Ditto for being able to specify your own
installation of Ant.

Cheerio,
Vil.

Alex wrote:

The Ant Tool window has really been bugging me. The Ant integration was so much simpler for me with XEmacs.

Build Environment: We have a build.xml file in each package directory, and also at the toplevel. We can build a single package, or the entire product.

How I used Ant in XEmacs: I would invoke ESC-x compile[RET], and run "ant -find build.xml compile" The command would automatically default to the current package directory I was working in. Errors would get printed in the compile message window and I could use keybindings to goto the errors in the java files.

IntelliJ IDEA: There is no way to invoke the build.xml for the package that the currently edited file belongs to. In order to compile a single package, I need to add that build.xml to the Ant Tool window. After invoking 'compile' target, the errors are displayed in the window at the bottom and I can goto next/previous error.

PROBLEMS IN IDEA ANT TOOL:
1) For build environments where there is a build.xml in each package, it is annoying to have to add each build.xml file to the Ant Tool window.

I would rather have the Ant Tool window monitor the editor window, similar to auto-scroll feature. When the editor changes to a differnet file, the Ant Tool window should determine which build.xml is applicable for that file, and automatically add it to the top of the Ant Tool window. THe algorithm should be the same that "ant -find build.xml" uses.

2) I noticed during a long compilation, if there were errors getting printed out, and I tried to look at them, IDEA would keep reseting the the current error to the last error in the message window each time more output was added. This made it very difficult to look at the errors while the compilation was happening.

In XEmacs, if I started going through the errors while compilation was happening, XEmacs would stop auto-scrolling the buffer.

3) The Ant output needs a QUIET option. I don't want to see every target getting printed out on the screen!. I have 'verbose' icon turned off, and I switched to text output rather than tree, but even then it is ridiculous. See below for the output for one package being compiled.

Ideally, I don't want IDEA to output anything. Our build.xml files automatically print out the info we want to see. For each package we output "SUBPROJECT: package".


SUBPROJECT: ipc.proxy
property
ant
init
property
condition
condition
property
property
property
property
property
property
property
property
property
property
property
property
property
property
condition
condition
property
property
property
property
property
property
property
compile
available
available
condition
antcall
createDirectories
mkdir
antcall
compileJavac
javac

4) I would like to set defaults for the 'Build File Properties' settings. Since I am constantly adding/removing build.xml files to the Ant Tool Window, I have to keep editing the properties, e.g. set maximum heap size, turn on make build in background.

5) I would like to be able to use any version of ANT. Is this possible? I would like to be able to configure which ANT to use similar to how we configure which JDK we use.

One annoying thing was that I had to add 'additional classpath' to the build file properties to add the netcomponents.jar file in order for <ftp> tasks to work. If IDEA coud just use my existing ANT 1.5.3 install, then this shouldn't be necessary since the netcomponents.jar is already in the ANT/lib directory.


--
Vilya Harvey
vilya.harvey@digitalsteps.com / digital steps /
(W) +44 (0)1483 469 480
(M) +44 (0)7816 678 457 http://www.digitalsteps.com/

Disclaimer

This e-mail and any attachments may be confidential and/or legally
privileged. If you have received this email and you are not a named
addressee, please inform the sender at Digital Steps Ltd by phone on
+44 (0)1483 469 480 or by reply email and then delete the email from
your system. If you are not a named addressee you must not use,
disclose, distribute, copy, print or rely on this email. Although
Digital Steps Ltd routinely screens for viruses, addressees should
check this email and any attachments for viruses. Digital Steps Ltd
makes no representation or warranty as to the absence of viruses in this
email or any attachments.

0
Comment actions Permalink

1) For build environments where there is a build.xml in each package, ...

see also
http://www.intellij.net/tracker/idea/viewSCR?publicId=13344

3) The Ant output needs a QUIET option. ...

see also
http://www.intellij.net/tracker/idea/viewSCR?publicId=4767

0
Comment actions Permalink

You make a couple of good points, but overall it
sounds like you're suffering because you're trying
to use Ant in the same way as you would have
used Makefiles. You might be able to simplify things
for yourself by making better use of Ant's features.
For example, you can created parameterised
build targets. You could have a single build file at
the top level of your project with a parameterised
target for compilation;
....


I think we do what you are suggesting.

We do have a master build.xml file at the toplevel which contains all the compilation, install, etc. rules and we have a package.txt property file to store the 3rd party jarfile and other dependencies.

Below is one of the build.xml which is in each directory. It sets the ${compile.dir}, and then calls the compile target in the master build.xml file.

The reason why we have a build.xml in each directory is so we can compile a single package rather than recompiling everything.

I guess what you are suggesting is we could take it step farther by setting the ${compile.dir} property on the ant commandline and rely on "ant -find build.xml" to find the master build.xml file. Something like:
$ ant -find build.xml -Dcompile.dir=.

Well, if we did that, wouldn't it be even harder to use this in IDEA? How would I compile a single package from IDEA then?

I can't believe we are the only people putting build.xml files in each package directory. For a large project, it really saves time to compile only the package you are working on. If I compile from the root of our source tree, it takes 7 min on a P4 3 Ghz machine

SUBPROJECT: ${ant.project.name} ]]>

0
Comment actions Permalink

maybe I'm totally wrong here but isn't javac supposed to compile only dirty files ? do you delete all your .class files prior to compile ? or do you have a really huge project ?

I'm personnaly not at all dealing with large projects so I can be very wrong but I found best and easiest to use is to use ant builds for "complex" builds (mixing different build operations, not only compile), and rely on IDEA compilation when I just want to compile small units of code (right click on package => compile). The only drawback i believe is it makes you duplicate your classpath settings in both IDEA and your ant builds

0
Comment actions Permalink

Alex wrote:

I think we do what you are suggesting.


You're right, I misunderstood your earlier post. My apologies.

I guess what you are suggesting is we could take it step farther by setting the ${compile.dir} property on the ant commandline and rely on "ant -find build.xml" to find the master build.xml file. Something like:
$ ant -find build.xml -Dcompile.dir=.


Actually, what I was suggesting was that you consolidate all of the
package-level build.xml files into the top-level one, with a single target
for each. You'd still have to manually select the correct target for the
package you wanted to recompile though, so it may not be that much of a
benefit after all. Sorry for wasting your time! :(

Vil.
--
Vilya Harvey
vilya.harvey@digitalsteps.com / digital steps /
(W) +44 (0)1483 469 480
(M) +44 (0)7816 678 457 http://www.digitalsteps.com/

Disclaimer

This e-mail and any attachments may be confidential and/or legally
privileged. If you have received this email and you are not a named
addressee, please inform the sender at Digital Steps Ltd by phone on
+44 (0)1483 469 480 or by reply email and then delete the email from
your system. If you are not a named addressee you must not use,
disclose, distribute, copy, print or rely on this email. Although
Digital Steps Ltd routinely screens for viruses, addressees should
check this email and any attachments for viruses. Digital Steps Ltd
makes no representation or warranty as to the absence of viruses in this
email or any attachments.

0
Comment actions Permalink

IDEA Compilation takes just as long as the ANT compilation. I don't see much difference.

Also, you bring up another major feature missing from IDEA's integration with ANT. IDEA cannot extract the build dependencies from your build.xml file.

Ideally, you should be able to point IDEA to a build.xml and have it automatically find the source path, output path, jdk version, compiler options and classpath, etc.
IDEA should be able to just look at the tasks. If there are multiple ]]> tasks, IDEA could prompt us with the list and ask us which ones we wanted to import.

I would use this not only for the initial setup of a project, but also to maintain the project.

Our build.xml files are the authoritative source. Not everyone in my department is using IDEA. People update the build.xml adding some new jarfiles are changing something else. Each time, I need to go manually transfer the change into IDEA project properties.
Currently, we have 30 3rd party jarfiles the compilation depends on.

0
Comment actions Permalink

Our build.xml files are the authoritative source. Not everyone in my

department is using IDEA. People update the build.xml adding some new
jarfiles are changing something else.

No way Jetbrains will reimplement ant just so that idea can interpret the
miriad ways ant can define paths/filesets/...

As long as ant integration is: read this property which has a fileset only
with a list of file/path includes. This could be possible.

And this is of limited value, as the build.xml does not mantain a connection
between libraries/sources/docs, so manual handling has to be done also.

And making a tool that reads the build.xml file _according to internal
specs_ and updates the idea iml files should not be to much work.


0
Comment actions Permalink

well my point was that, as far as I can see, compiling packages independently from each others only makes sense as long as they are -really- independent, and thus probably different components. If it is the case I guess i'd prefer have 1 IDEA project for each of them.

Anyway, if some people do use ant as makefiles why not adding this functionality...

Concerning
>Ideally, you should be able to point IDEA to a build.xml
>and have it automatically find the source path, output
>path, jdk version, compiler options and classpath, etc.
well ... I wouldn't even dream of an IDE capable of doing that as ant build files can be written in so many different ways. But ... I think IDEA has filled some needs I wouldn't have dream of already, so ... :)

0

Please sign in to leave a comment.