I'm trying to build a web application which takes it's class files from multiple locations. These locations can contain the same class files. I need to be able to specify a priority so that some locations take priority over others when copying the classes across.
We have separate ant scripts which build the WAR file. This build is to hotswap in any changed classes whilst I am developing. So this build must be quick.
For example, my two class locations are:
- /bin
- /build/classes
I want classes from both these directories to be copied to: /web/WEB-INF/classes
However, if both these locations contain the same class file, eg:
- /bin/com/ben/Test.class
- /build/classes/com/ben/Test.class
I want files in /bin to always take priority.
So in the example:
- the file: /bin/com/ben/Test.class, would be copied.
- the file: /build/classes/com/ben/Test.class will be ignored.
My current script looks like this:
<sync todir="${deploy}/WEB-INF/classes" verbose="true">
<fileset dir="bin"/>
<fileset dir="build/classes"/>
</sync>
This works, but each time the script is run, dangling files are removed. I'm also not sure if any priority here is guaranteed.
Any assistance would be appreciated.