ANT: copy the contents of multiple sets of files with the same files in priority order

I am trying to create a web application that accepts its class files from several places. These locations may contain the same class files. I need to specify priority so that some places take precedence over others when copying classes through.

We have separate ant scripts that build a WAR file. This assembly is a hotswap in any modified classes during development. Therefore, this assembly should be fast.

For example, my two classes:

  • /Ben
  • / assemblies / classes

I want classes from both of these directories to be copied to: / Web / WEB-INF / classes

However, if both of these locations contain the same class file, for example:

  • /bin/com/ben/Test.class
  • /build/classes/com/ben/Test.class

, /bin .

, :

  • :/bin/com/ben/Test.class.
  • :/build/classes/com/ben/Test.class .

script :

<sync todir="${deploy}/WEB-INF/classes" verbose="true">
    <fileset dir="bin"/>
    <fileset dir="build/classes"/>
</sync>

, , script, . , .

.

+3
2

, , "$ {deploy}/WEB-INF/classes?

Sync , , .

, .

  <copy todir="${deploy}/WEB-INF/classes" verbose="true">
    <fileset dir="build/classes"/>
  </copy>

  <copy todir="${deploy}/WEB-INF/classes" verbose="true"  overwrite="true">
    <fileset dir="bin"/>
  </copy>

test.class /, test.class bin.

+3

, , , , . ,

<war [...] duplicate="preserve">
    [...]
    <classes dir="bin"/>
    <classes dir="build/classes"/>
</war>
+1

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


All Articles