First of all, thanks for the solution - it works :)

By the way, before I implemented what you've suggested, the situation was that 
only sometimes the jar was touched by ant (in case no class files were updated).
Can you explain why only sometimes the jar touched, and not always (or never)?

Thanks,

Barak.
-----Original Message-----
From: Andrew Goktepe [mailto:[EMAIL PROTECTED]
Sent: ?? 01 ?????? 2005 16:57?
To: Ant Users List
Subject: Re: Jar task updated a jar without known reason

The jar task will do as its told without checking to see if there is already
an up-to-date file, just as with the jar command-line utility.
 Yes, without the update attribute set, the jar file will be re-created each
time.
 -Andrew

 On 9/1/05, Barak Yaish <[EMAIL PROTECTED]> wrote:
>
> First of all, Thanks!
>
> But can you tell WHY Ant touched my jar?
>
> Regarding your second comment, if I'll omit the update flag, the jar will
> be recreated every time the task is executed?
>
> Thanks,
>
> Barak.
>
> -----Original Message-----
> From: Andrew Goktepe [mailto:[EMAIL PROTECTED]
> Sent: ?? 01 ?????? 2005 16:46?
> To: Ant Users List
> Subject: Re: Jar task updated a jar without known reason
>
> You can use the <uptodate> task to compare timestamps between a set of
> files
> and a target file. In your case, the set of files are your class files,
> and
> the target file is your jar file.
> <target name="compile_cli">
> (your current contents of compile_cli here)
> <uptodate property="skip.jar" targetfile="${jars}/cli.jar">
> <srcfiles dir="${cli_output}" includes="project/manager/tools/CLI/**"/>
> </uptodate>
> </target>
> <target name="jar_cli" unless="skip.jar" depends="compile_cli">
> <jar destfile="${jars}/cli.jar"
> basedir="${cli_output}"
> includes="project/manager/tools/CLI/**"
> update="true"
> />
> </target>
> Also, are you sure you want update="true" on the jar task? This will add
> files to the previously-built jar rather than creating a new one. If you
> remove files from your source, the jar will still keep the outdated files.
> -Andrew
>
> On 9/1/05, Barak Yaish <[EMAIL PROTECTED]> wrote:
> >
> > Hello,
> >
> > In my build file, javac and jar task are called in order to create a jar
> > for my project.
> > First time these tasks were called, the source files got compiled and a
> > jar was created just fine. Without changing anything in the source
> files, I
> > ran again the tasks.
> > Nothing happened in javac task, as expected, but the jar task changed
> the
> > time stamp of the jar. The question is: why? A check I did rais that the
> Ant
> > change the time stamp of the manifest file, even without changing its
> > content. For some reasons, it is very important to me that the time
> stamp of
> > the jar file wouldn't be changed unless a source file changed.
> > This is how the jar task is written in my build file:
> >
> > <target name="jar_cli" depends="compile_cli">
> > <jar destfile="${jars}/cli.jar"
> > basedir="${cli_output}"
> > includes="project/manager/tools/CLI/**"
> > update="true"
> > />
> > </target>
> >
> > Can someone explain me please how can I avoid such situation?
> >
> > Thanks,
> >
> > Barak.
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to