views:

139

answers:

4

I'm deploying my project to a web-server to be deployed with java Web Start. However, Web Start uses modification date to figure out whether to download the resources again (by default).

What I want is a way to only deploy those (jar) files that do not already exist. This is made possible by having build-version numbers on all my jars, so 2 jars with the same name have the same contents.

Notes:

  • The jar modification dates will always be newer in the build (which is why I'm getting this problem), due to downloading from svn or ivy
  • There's a way to do this using sun's download servlet, more files etc, but I'm lazy, don't need it, and this (simpler) solution will be more robust in the long term
A: 

You could attempt to set the granularity attribute very, very high, to basically disable the "copy files with the same name if the source file is newer than the destination" feature.

matt b
+3  A: 

If you are using ants copy task (you don't explicitly say you are), you could try the present selector: http://ant.apache.org/manual/Types/selectors.html#presentselect.

<copy todir="target">
  <fileset dir="src">
    <present targetdir="target" present="srconly" />
  </fileset>
</copy>
matt
A: 

We had a similar problem, and I wound up implementing my own jar task to do what I needed. The Ant source code is a good place to start; if you're lucky you might be able to just subclass Ant's jar task. It's not nearly as difficult as it might sound, and was much more straightforward than the half dozen workarounds I tried or considered.

Sarah K
A: 

We solved this issue with maven and JavaFX and WebStart Plugin that keeps maven layout and version in the JNLP, and using "non-unique" SNAPSHOT will keep the same jar (ignoring the timestamp).

I know it's maven so not good for you, but someone may give it a try?

Fred Simon