Ant task to copy the properties file to the appropriate location in the java build dir directory

OK, I'm at a standstill.

I have a Java tree that looks like a pretty typical Java Eclipse build:

myproject src com example test // Java files in com.example.test here bin com example test // Compiled class files will go here 

Now I have the MyClass.properties file in myproject/src/com/example/test along with the Java source files. How to write an appropriate ant task to copy all modified .properties files in the source tree to the appropriate places in the assembly tree ( myproject/bin )?

(The simpler half is to make the actual copy, the more complex half of this, I suppose, is checking the dependencies)

+6
java properties ant
source share
2 answers

What about:

 <copy todir="myproject/bin"> <fileset dir="myproject/src" includes="**/*.properties"/> </copy> 
+16
source share

From the Ant manual on the task:

Copies a file or collection of resources to a new file or directory. By default, files are only copied if the source file is later than the destination file, or when the target file does not exist. However, you can explicitly overwrite files with the overwrite attribute.

+3
source share

All Articles