ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Goktepe <andrewgokt...@gmail.com>
Subject Re: Jar task updated a jar without known reason
Date Thu, 01 Sep 2005 13:45:50 GMT
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 <byaish@cloverleafcomm.com> 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.
> 
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message