Ant:无法让 Ant 将属性文件复制到 类 目录

Ant: Unable to get Ant to copy properties file to classes directory

我有一个可以使用 Ant 正确构建和部署的项目

我想构建一个 war 文件来部署项目。

除了无法让属性文件出现在 类 目录中之外,我可以让一切正常工作。

我的属性文件位于:/h/a/A/I/S/src/Serv/log4j.properties

这是我的构建文件的 war 部分:

<war destfile="Int.war" webxml="web/WEB-INF/web.xml">
     <lib dir="${libDir}" />

     <classes dir="${outputDir}" includes="/h/a/A/I/S/src/Serv/log4j.properties"/>
     <classes dir="${outputDir}" />

   </war>

我在这里阅读了之前提出的类似问题,并在此处添加了第二个 类 元素,其中包括属性文件,但它对我不起作用,有任何建议

在这一行中,.properties 文件的路径将被 ant 假定为“${outputDir}/h/a/A/I/S/src/Serv/log4j.properties”,这在您的项目中是一个无效路径。 尝试使用复制任务将 .properties 文件移动到“${outputDir}”目录,然后执行 war 打包。