Poor performance while editing Ant build scripts

Having a few issues with IDEA 7.0 and editing ant scripts.

First problem is editing my ant scripts inside IDEA is really slow. Even adding newlines I have to wait for something to happen, although its the completion that drags it's heals the most. These aren't big scripts although they do all import a single common script. That's about 400 lines (by far the largest). Editing Java source is acceptable (dual core, 2 gigs memory) but editing the build scripts ouch!

The other issue my be related, I'm using Ivy so I've added the ivy namespace to my build scripts (xmlns:ivy="antlib:org.apache.ivy.ant") but IDEA isn't recognising this and mark it and several Ivy targets as error. This is despite adding the Ivy jars to the classpath of the script? Is this supported and will several taskdefs drag the responsivness inside IDEA down? can I tweak something to bring some performance back?

Never have much luck with taskdefs and IDEA. Is their some trick to making them work? would copying the jars into IDEAs classpath help at all?

5 comments

Hello Richard,

Having a few issues with IDEA 7.0 and editing ant scripts.

First problem is editing my ant scripts inside IDEA is really slow.
Even adding newlines I have to wait for something to happen, although
its the completion that drags it's heals the most. These aren't big
scripts although they do all import a single common script. That's
about 400 lines (by far the largest). Editing Java source is
acceptable (dual core, 2 gigs memory) but editing the build scripts
ouch!


There is one notorious issue with performance of ant integration in 7.0.0.
IDEA evaluates fileset / dirset elements, if they are used in taskdefs. So,
if you write
]]>
<include name="*/"/>
</fileset>
and use this in a typedef/taskdef, then IDEA internally builds the collection
of all files on C: drive. It eats performance. In the latest 7.0.* updates
we have set a limit to this collections, so if they grow too much, this analysis
stops. I don't know, if this your issue, but you could try the latest IDEA
update: 7.0.2 or EAP.

The other issue my be related, I'm using Ivy so I've added the ivy
namespace to my build scripts (xmlns:ivy="antlib:org.apache.ivy.ant")
but IDEA isn't recognising this and mark it and several Ivy targets as
error. This is despite adding the Ivy jars to the classpath of the
script? Is this supported and will several taskdefs drag the
responsivness inside IDEA down? can I tweak something to bring some
performance back?


I've loaded Ivy's sample build-a-ivy-repository into IDEA and corrected paths
to ivy jar. Got 3 error marks. 1 is for not defined URI. You can do Alt+Enter
and select "Ignore resource". 2 more are for usage of <ivy:settings> element
within target. This is bug http://www.jetbrains.net/jira/browse/IDEADEV-24366,
thanks for reporting (and the issue is not the namespace usage). If you see
some more errors, you're welcome to specify what ones.

Never have much luck with taskdefs and IDEA. Is their some trick to
making them work? would copying the jars into IDEAs classpath help at
all?


With new fileset / dirset resolving, basically, if your typedef correctly
refers to necessary libraries, it should work.

Regards,
Alexander.


0

There is one notorious issue with performance of ant integration in 7.0.0.
IDEA evaluates fileset / dirset elements, if they are used in taskdefs


I suppose I do have something very much like that:

]]>
<fileset dir="${project.build.lib}" includes="*/.jar"/>
Is there a bug/tracker number for the issue so I can keep an eye for it in the builds? Will specifying the direct path to the dependant jars help any? (on 7.0.2 final - will try a newer EAP). >This is bug http://www.jetbrains.net/jira/browse/IDEADEV-24366, >thanks for reporting (and the issue is not the namespace usage). If you see >some more errors, you're welcome to specify what ones. OK, I only really mentioned the errors because it's obvious IDEA was doing a lot of processing/searching in the background. I wondered if it was desperately trying to validate and kept failing. The other errors I see are perhaps ones you'd expect. Ivy can generate things called Ivy variables which are also exposed as ant properties - obviously properties generated by taskdefs IDEA doesn't directly support all get marked as errors. >With new fileset / dirset resolving, basically, if your typedef correctly >]]>refers to necessary libraries, it should work.

Wondered about that - because I've been using IDEA and Ant since 2.x and a creature of habit I've been adding external jars to the ant classpath (via script properties) if not Idea libs too. So the additional classpath on the ant build script isn't needed anymore? (at least not if you specify the classpath via taskdef).

Thanks for the info,

- Richard

0

Is there a bug/tracker number for the issue so I can keep an eye for
it in the builds?

http://www.jetbrains.net/jira/browse/IDEADEV-19514
The problem is that if user's library really contains 1000 files then we
have to follow. So, we have to read the fileset as it written first before
understand is it needed or not.

Will specifying the direct path to the dependant
jars help any? (on 7.0.2 final - will try a newer EAP).

If this is really the problem, then yes, specifying more narrow file set
should help.

>> With new fileset / dirset resolving, basically, if your typedef
>> correctly refers to necessary libraries, it should work.
>>

Wondered about that - because I've been using IDEA and Ant since 2.x
and a creature of habit I've been adding external jars to the ant
classpath (via script properties) if not Idea libs too. So the
additional classpath on the ant build script isn't needed anymore? (at
least not if you specify the classpath via taskdef).


Yes, in IDEA 7 you can write, for example:
]]>
And IDEA correctly defines the task without additional classpath.

Alexander.


0

The problem is that if user's library really contains 1000 files then we
have to follow
...
If this is really the problem, then yes, specifying more narrow file
set should help.


Ah, probably not my issue then as the ${project.build.lib} path in my example is only the path to jars needed for the projects build/testing only. Probally no more than 20 jars (Ivy, ant-contrib, Junit, easymock and the like). To be honest the slowness is persistent it's not like its only slow on startup while resolving - more perpetually sluggish as soon as I start trying to make changes.

Also wondered if importing scripts wasn't causing an extra overhead. I've created a modular build so every module imports the common script - overriding only the targets it needs to (if it needs to). Although IDEA doesn't know about the module scripts (not added to the ant panel). I guess it's still resolving things when I open them in the editor though.

Yes, in IDEA 7 you can


Ok so, old dog learns a new trick.

Thanks.

0

Ah, probably not my issue then as the ${project.build.lib} path in my
example


In this case CPU snapshot could help us to reproduce the problem.

It also would be nice if you are able to attach your build scripts, but I
understand that it may be private information.

Alexander.


0

Please sign in to leave a comment.