You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Detlef Brendle <de...@canoo.com> on 2002/04/11 11:44:10 UTC

Ant project question

Hi ,
Im developing a Java application in which I instatiate an Ant project as

fProject = new Project();
fProject.init();
...
ProjectHelper.configureProject(fProject, ANT_BUILD_FILE);

after instatiating the project I then can call

fProject.executeTargets(buildSequence()));

which executes a set of targets with the necessary parameters.

At the first time (with no instance of project in my classloader) it runs
perfect.

At the second time Ant cannot delete certain files (jar files for compiling
the project).

My idea was to set the project instance to null after beeing used - but this
doesnt help me.


does anybody has got an idea about how I could solve this.

thanks,

detlef


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Ant project question

Posted by Stefan Bodewig <bo...@apache.org>.
On Thu, 11 Apr 2002, Detlef Brendle <de...@canoo.com> wrote:

> At the second time Ant cannot delete certain files (jar files for
> compiling the project).
> 
> My idea was to set the project instance to null after beeing used -
> but this doesnt help me.

You should make sure that Project#fireBuildFinished has been called -
this one will trigger a cleanup in all classloaders Ant has
instantiated.  Also put a System.gc after setting project to null.

But it may not be enough even after that.  The Java VM itself is known
to not close jar files that are on the classpath, so you cannot delete
those files as long as your Java VM is running.

Can you spawn separate VMs for your Ant runs so that you gert a chance
to clean up?

Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>