You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Jay Dickon Glanville <di...@gmail.com> on 2007/07/24 18:11:15 UTC

ant holds on to jar, preventing deletion?

Hello all.

I'm dealing with a "can't delete file" problem, but one with a slight
twist.  I believe the situation might be that ant has a handle on a
jar file, which is then preventing it from being deleted.  (Note, this
is windows specific.)

The sequence of events goes like this:
 - create jar file from XML code (XML-Beans)
 - use jar file in classpath to compile other files
 - delete jar file HD
I know that there are no other processes holding that file, as I just
created it (that, and there are no other processes on my machine).

Does this make sense?  If so, is there a solution?

JDG

-- 
Jay Dickon Glanville

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: ant holds on to jar, preventing deletion?

Posted by Dominique Devienne <dd...@gmail.com>.
On 7/24/07, Jay Dickon Glanville <di...@gmail.com> wrote:
> Thanks for the suggestion Dominique, but it doesn't solve the problem.

Ah, well, it's always the first one that comes to mind ;-)

> Does it matter if I have the jar declared in a path statement?  Like this:
>   <path id="nci.common.cp_ref">
>     <pathelement location="${cdr.jar}" />
>   </path>

I don't think the <path> has anything to do with it. It's only a
collection of file names, it doesn't need to open any of them.
(although underneath the cover, a lot of things have changed to
support resource collections, and I've never studied this code)

> An additional piece of information that might help: the jar file is
> being generated by the XML Beans toolset (you provide the XML schema
> doc to the XMLBeans ant task, it generates the java, compiles, and
> then jars).

Then try to isolate this step out of the target chain, by running it
in a separate Ant invocation, and then doing the compile+delete step
in another (possibly disconnecting some target dependency to avoid
running the xmlbeans stuff again). This way you can find out if it's
the xml-beans stuff leaking the file-handle on the jar. --DD

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: ant holds on to jar, preventing deletion?

Posted by Jay Dickon Glanville <di...@gmail.com>.
Thanks for the suggestion Dominique, but it doesn't solve the problem.

Does it matter if I have the jar declared in a path statement?  Like this:
  <path id="nci.common.cp_ref">
    <pathelement location="${cdr.jar}" />
  </path>

An additional piece of information that might help: the jar file is
being generated by the XML Beans toolset (you provide the XML schema
doc to the XMLBeans ant task, it generates the java, compiles, and
then jars).


JDG



On 7/24/07, Dominique Devienne <dd...@gmail.com> wrote:
> Try forking your <javac> task, which may be the one holding on to the jars. --DD
>
> On 7/24/07, Jay Dickon Glanville <di...@gmail.com> wrote:
> > Hello all.
> >
> > I'm dealing with a "can't delete file" problem, but one with a slight
> > twist.  I believe the situation might be that ant has a handle on a
> > jar file, which is then preventing it from being deleted.  (Note, this
> > is windows specific.)
> >
> > The sequence of events goes like this:
> >  - create jar file from XML code (XML-Beans)
> >  - use jar file in classpath to compile other files
> >  - delete jar file HD
> > I know that there are no other processes holding that file, as I just
> > created it (that, and there are no other processes on my machine).
> >
> > Does this make sense?  If so, is there a solution?
> >
> > JDG
> >
> > --
> > Jay Dickon Glanville
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>


-- 
Jay Dickon Glanville

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: ant holds on to jar, preventing deletion?

Posted by Dominique Devienne <dd...@gmail.com>.
Try forking your <javac> task, which may be the one holding on to the jars. --DD

On 7/24/07, Jay Dickon Glanville <di...@gmail.com> wrote:
> Hello all.
>
> I'm dealing with a "can't delete file" problem, but one with a slight
> twist.  I believe the situation might be that ant has a handle on a
> jar file, which is then preventing it from being deleted.  (Note, this
> is windows specific.)
>
> The sequence of events goes like this:
>  - create jar file from XML code (XML-Beans)
>  - use jar file in classpath to compile other files
>  - delete jar file HD
> I know that there are no other processes holding that file, as I just
> created it (that, and there are no other processes on my machine).
>
> Does this make sense?  If so, is there a solution?
>
> JDG
>
> --
> Jay Dickon Glanville
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org