You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Gad Abraham <ga...@e1c.net> on 2005/08/19 09:51:48 UTC

Updating jar fails

Hi,

I've seen this problem before on this list but no answers were given.

I'm trying to add a class file to an existing jar, but it fails silently
(does nothing whatsoever). I even try to sleep for 5 seconds so the
class file gets a newer timestamp than the jar (they end up having a
very close timestamp nonetheless).

<target name="packAWT" depends="compileAWT, init">
   <copy file="src/applet.jar" todir="dest"/>
   <sleep seconds="5"/>
   <touch file="dest/e3/e30.class"/>
   <jar destfile="dest/applet.jar"
        update="true"
	includes="dest/e3/e30.class" />
</target>

Running ant with -debug shows nothing. Ant version is 1.6.5 on Java
1.4.2_08b for Linux.

Any ideas?

Thanks,
Gad

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


Re: Updating jar fails

Posted by Gad Abraham <ga...@e1c.net>.
Carol Enderlin wrote:
> I tried it out and it worked with added basedir (removed dest from the
> includes line):
> 
> <target name="packAWT" >
>   <copy file="src/applet.jar" todir="dest"/>
>    <sleep seconds="5"/>
>    <touch file="dest/e3/e30.class"/>
>   <jar destfile="dest/applet.jar" basedir="dest"
>         update="true"
>       includes="e3/e30.class" />
> </target>
> 

Thanks Carol!

I've followed your advice and it works.

Now I see that the includes is relative to the basedir, so previously 
ant couldn't find the e30.class because it wasn't looking in the right 
place (although I'd expect it to complain...).

I really appreciate your help!

Cheers,
Gad

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


Re: Updating jar fails

Posted by Carol Enderlin <ca...@gmail.com>.
I tried it out and it worked with added basedir (removed dest from the
includes line):

<target name="packAWT" >
  <copy file="src/applet.jar" todir="dest"/>
   <sleep seconds="5"/>
   <touch file="dest/e3/e30.class"/>
  <jar destfile="dest/applet.jar" basedir="dest"
        update="true"
      includes="e3/e30.class" />
</target>

Try adding -v to your ant command to get more details about what it is doing. 

part of the verbose output I got:

packAWT:
     [copy] C:\tools\code\antstuff\updatejar\src\applet.jar omitted as
C:\tools\code\antstuff\updatejar\dest\applet.jar is up to date.
    [sleep] sleeping for 5000 milliseconds
      [jar] e3\e30.class added as e3/e30.class is outdated.
      [jar] Updating jar: C:\tools\code\antstuff\updatejar\dest\applet.jar
      [jar] adding directory META-INF/
      [jar] adding entry META-INF/MANIFEST.MF
      [jar] adding directory e3/
      [jar] adding entry e3/e30.class

On 9/1/05, Gad Abraham <ga...@e1c.net> wrote:
> Gad Abraham wrote:
> > Stefan Bodewig wrote:
> >
> >>On Fri, 19 Aug 2005, Gad Abraham <ga...@e1c.net> wrote:
> >>
> >>
> >>
> >>><target name="packAWT" depends="compileAWT, init">
> >>>  <copy file="src/applet.jar" todir="dest"/>
> >>>  <sleep seconds="5"/>
> >>>  <touch file="dest/e3/e30.class"/>
> >>>  <jar destfile="dest/applet.jar"
> >>>       update="true"
> >>>     includes="dest/e3/e30.class" />
> >>></target>
> >>
> >>
> >>I don't see a basedir attribute on the jar task, where does it point
> >>to?
> >
> >
> > I've tried both with and without a <basedir="dest">, but the results are
> > the same - the build succeeds, but nothing happens. I don't want to
> > create a new jar, just update an existing one.
> 
> Anyone?
> 
> 
> 
> ---------------------------------------------------------------------
> 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


Re: Updating jar fails

Posted by Gad Abraham <ga...@e1c.net>.
Gad Abraham wrote:
> Stefan Bodewig wrote:
> 
>>On Fri, 19 Aug 2005, Gad Abraham <ga...@e1c.net> wrote:
>>
>>
>>
>>><target name="packAWT" depends="compileAWT, init">
>>>  <copy file="src/applet.jar" todir="dest"/>
>>>  <sleep seconds="5"/>
>>>  <touch file="dest/e3/e30.class"/>
>>>  <jar destfile="dest/applet.jar"
>>>       update="true"
>>>	includes="dest/e3/e30.class" />
>>></target>
>>
>>
>>I don't see a basedir attribute on the jar task, where does it point
>>to?
> 
> 
> I've tried both with and without a <basedir="dest">, but the results are
> the same - the build succeeds, but nothing happens. I don't want to
> create a new jar, just update an existing one.

Anyone?



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


Re: Updating jar fails

Posted by Gad Abraham <ga...@e1c.net>.
Stefan Bodewig wrote:
> On Fri, 19 Aug 2005, Gad Abraham <ga...@e1c.net> wrote:
> 
> 
>><target name="packAWT" depends="compileAWT, init">
>>   <copy file="src/applet.jar" todir="dest"/>
>>   <sleep seconds="5"/>
>>   <touch file="dest/e3/e30.class"/>
>>   <jar destfile="dest/applet.jar"
>>        update="true"
>>	includes="dest/e3/e30.class" />
>></target>
> 
> 
> I don't see a basedir attribute on the jar task, where does it point
> to?

I've tried both with and without a <basedir="dest">, but the results are
the same - the build succeeds, but nothing happens. I don't want to
create a new jar, just update an existing one.


Gad

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


Re: Updating jar fails

Posted by Stefan Bodewig <bo...@apache.org>.
On Fri, 19 Aug 2005, Gad Abraham <ga...@e1c.net> wrote:

> <target name="packAWT" depends="compileAWT, init">
>    <copy file="src/applet.jar" todir="dest"/>
>    <sleep seconds="5"/>
>    <touch file="dest/e3/e30.class"/>
>    <jar destfile="dest/applet.jar"
>         update="true"
> 	includes="dest/e3/e30.class" />
> </target>

I don't see a basedir attribute on the jar task, where does it point
to?

Stefan

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