为了便于访问,我在一系列项目文件夹的父级中有几个配置文件。在构建项目时,他们需要复制到项目源文件夹之一,直到构建完成后,然后我希望将它们删除。目前,我有这个:
<target name="build-java">
<copy file="config.properties" todir="project/src" />
<!-- Build other projects -->
<delete file="project/src/config.properties" />
</target>
Run Code Online (Sandbox Code Playgroud)
如果项目建立,哪个工作。唉,我的骄傲,他们并不总是如此。理想情况下,我想要相当于以下 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.
Run Code Online (Sandbox Code Playgroud)