Ant concat文件集分隔符
在Ant中将concat与文件集一起使用时,如何为文件集中的每个元素执行操作。例如,添加字符串:Ant concat文件集分隔符,ant,Ant,在Ant中将concat与文件集一起使用时,如何为文件集中的每个元素执行操作。例如,添加字符串: <fileset dir="${project.path.scripts-library}" excludes="!*.js, **/*.bak, **/dev.*" > <type type="file" /> <include name="**/0*.js" /> <include name="**
<fileset dir="${project.path.scripts-library}"
excludes="!*.js, **/*.bak, **/dev.*"
>
<type type="file" />
<include name="**/0*.js" />
<include name="**/1*.js" />
<string>test</string>
</fileset>
测试
或者为文件集中的每个文件回显当前文件名(以及,如何获取当前文件的文件名??):
我认为默认ant中没有这样的东西。最接近的是,但它是特定于系统的:
<apply executable="echo"> <!-- run this command with each file name -->
<fileset dir="/tmp" includes="**/*.*"/>
</apply>
要启用任务:
文件[@{file}]
当您说“concat test”时,是指在每个文件名的末尾添加“test”,还是在每个文件的每行末尾添加“test”?我的意思是,这些文件被连接到一个文本文件中。在将每个文件连接到该文本文件后,还要将(在本例中为测试)的内容连接到该文件中。对于所有只搜索在每个文件后追加新行的人:fixlastline=“yes”。
<apply executable="echo"> <!-- run this command with each file name -->
<fileset dir="/tmp" includes="**/*.*"/>
</apply>
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
<for param="file">
<path>
<fileset dir="/tmp" includes="**/*.*"/>
</path>
<sequential> <!-- run any task here -->
<echo>file [@{file}]</echo>
</sequential>
</for>