For ease of access, I have a couple of config files in the parent of a series of project folders. When building the projects, they need copying into one of the projects source folders until after the build is finished, whereupon I'd like them to be deleted. At the moment, I have this:
<target name="build-java">
<copy file="config.properties" todir="project/src" />
<!-- Build other projects -->
<delete file="project/src/config.properties" />
</target>
Which does the job if the projects build. Alas for my pride, they don't always. Ideally, I'd like the equivalent of the following Java:
File src = new File("config.properties");
File dst = FileUtils.copyFile(src, "project/src");
dst.deleteOnExit();
// Carry on with the rest of the build, content in the knowledge that whatever happens, the file will die.
But neither the Copy nor the Delete ant tasks seem up to the job. This doesn't seem like a particularly obscure need?