Copying only nonexistent files to ant

I am deploying my project to a web server for deployment using java Web Start. However, Web Start uses the modification date to find out if resources need to be reloaded (by default).

What I want is a way to deploy those (jar) files that don't exist yet. This was made possible due to the presence of assembly version numbers on all my jars, so 2 jars with the same name have the same contents.

Notes:

  • Jar modification dates will always be newer in the assembly (which is why I get this problem), due to loading from svn or ivy
  • There is a way to do this using the download servlet, more files, etc., but I'm lazy, don't need it, and this (simpler) solution will be more reliable in the long run
+3
source share
4 answers

If you use the ant copying task (you don’t explicitly say that it is), you can try the selector present: http://ant.apache.org/manual/Types/selectors.html#presentselect .

<copy todir="target">
  <fileset dir="src">
    <present targetdir="target" present="srconly" />
  </fileset>
</copy>
+13
source

You can try to set the granularityattribute very, very high to basically disable "copy files with the same name if the source file is newer than the destination function.

+2
source

, , , . Ant - ; , Ant jar. , , , , .

0
source

We solved this problem with maven and JavaFX and the WebStart plugin , which stores the maven layout and version in JNLP and uses the "unique" SNAPSHOT, will keep the same jar (ignoring the timestamp).

I know this is so good for you, but can someone try?

0
source

Source: https://habr.com/ru/post/1724249/


All Articles