ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Elankath, Tarun (Cognizant)" <ETa...@blr.cognizant.com>
Subject Problem with Ant Automation using Ant API
Date Mon, 18 Nov 2002 10:43:27 GMT
Hi all,

I have developed a GUI tool that makes use of the Ant API and an existing
build.xml file for our project.
(Targets are represented as "icons" on the toolbar)

As soon as the GUI application starts up, it creates a new Project object
and configures it with an existing build file and keeps the project object
as an instance variable called 'project'

Whenever an icon on the toolbar is clicked, the statement
"Project.executeTarget(targetname)" gets executed (in a separate thread).
The problem is that whenever the same target icon is clicked a second time,
it fails with the error "Duplicate target".

This is because for some reason, the project object loads all the default
tasks and definitions once again from the build.xml file, thus coming across
the all the targets once again (which were already loaded during startup).

My question is this:
Is there anyway to prevent Project from loading all tasks and defitions
repeatedly from the build file ?
If not I guess the only alternative is to create a new Project object
everytime a target is clicked on, call ProjectHelper.configureProject(), and
then call executeTarget() on the new project object.  This way seems
wasteful to do everytime.


All help/pointers appreciated,
Tarun


Mime
View raw message