views:

23

answers:

1

Hi, I'm using Eclipse and Ant in my development environment.

I've come across a problem

Here's part of my build.xml

<target name="deploy" depends="dist" description="deploy jar files">
    <!-- Deploy jar files on local Tomcat -->
    <echo>Deploying in ${tomcat_home}/webapps</echo>

  <echo>Copying JSP files from ${build_dir} to ${tomcat_home}/${ant.project.name}/$</echo>
  <copy todir="${tomcat_home}/webapps/">
   <fileset dir="${resources_dir}/" includes="**/*.jsp"/>
  </copy> 

I change a file, then run an ant build - all the files and jars are copied to the right place on my server.

But the problem I have is, if I make another change quickly and then run Ant again, my files aren't copied. Obviously Any is looking at the timestamp to see when I last updated the file. If it matches the same minute, it doesn't update.

How can I force the file copying every time?

Thanks

+1  A: 

Hi jeph. You can use overwrite="true" to force Ant to always overwrite files. But looking at the manual, I also found this interesting tidbit regarding the granularity attribute:

The number of milliseconds leeway to give before deciding a file is out of date. This is needed because not every file system supports tracking the last modified time to the millisecond level. Default is 1 second, or 2 seconds on DOS systems. This can also be useful if source and target files live on separate machines with clocks being out of sync. since Ant 1.6.2.

You could try experimenting with this to see if it helps.

Matt Solnit
Thanks very much
jeph perro