Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cocoa/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ant任务将属性文件复制到java构建目录中相应的位置_Java_Ant_Properties - Fatal编程技术网

ant任务将属性文件复制到java构建目录中相应的位置

ant任务将属性文件复制到java构建目录中相应的位置,java,ant,properties,Java,Ant,Properties,好吧,我被难住了 我有一个Java树,看起来像一个相当典型的Eclipse Java构建: myproject src com example test // Java files in com.example.test here bin com example test // Compiled class files will go here 现在我在myproject/s

好吧,我被难住了

我有一个Java树,看起来像一个相当典型的Eclipse Java构建:

myproject
  src
    com
      example
        test
          // Java files in com.example.test here
  bin
    com
      example
        test
          // Compiled class files will go here
现在我在
myproject/src/com/example/test
中有一个
MyClass.properties
文件以及源Java文件。如何编写适当的ant任务,将源代码树中所有已更改的.properties文件复制到构建(
myproject/bin
)树中相应的位置


(这其中较容易的部分是进行实际复制;我猜较难的部分是检查依赖项)

来自Ant手册中关于任务的部分:

将文件或资源集合复制到新文件或目录。默认情况下,仅当源文件比目标文件新或目标文件不存在时,才会复制文件。但是,可以使用“覆盖”属性显式覆盖文件

那么:

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


ok,这就回答了我对依赖关系的检查。语法呢?我好像搞不懂,对不起,我很笨(就这样?!谢谢!复制任务的手册在哪里谈到了**/保存目标目录的路径?它没有明确提到这一点,但我想你可以这样得出结论:匹配文件时,从基本目录到该文件的路径也会被捕获。知道了这一点,请看描述复制任务上的“展平”属性无效。展平=true时描述的行为意味着路径为false时将保留。