0
我正在编写一个ant构建文件来检查目录中的所有翻译文件。 我希望脚本的ant能够在任何文件中出现检查错误时继续检查其余文件。 我的Ant任务: Ant脚本如果任何迭代失败,如何继续
<taskdef name="validate" classname="ValidateTranslateFile">
<classpath>
<pathelement location="${ant-libs-dir}/TranslateFileUtilities.jar" />
<pathelement location="../web/WEB-INF/lib/commons-io-2.5.jar" />
<pathelement location="../web/WEB-INF/lib/commons-lang3-3.5.jar" />
</classpath>
</taskdef>
<for param="program">
<path>
<fileset dir="../web/WEB-INF" includes="*.txt" />
</path>
<sequential>
<validate targetFile="@{program}" checkLanguages="true" checkKeysOrder="true" />
</sequential>
</for>
</target>
的结果: 它会检查,直到第一个错误的文件出现,然后构建失败。
任何人都可以帮助我吗?
感谢您的解决方案。实际上我之前读过那个页面中的代码,但我无法理解这种重构的方法论。 你知道如何迭代创建的文件吗? –
@ AhmadAl-Khazraji我在这里搜索了一些从开源项目中提取的示例:http://www.programcreek.com/java-api-examples/org.apache.tools.ant.types.FileSet。我个人更喜欢使用groovy脚本来扩展Ant,请参阅:http://stackoverflow.com/questions/5075017/ant-process-the-files-in-the-subfolder-using-tasks/5083342#5083342 –