我正在使用ant脚本来计算特定文件夹中两个文件的md5。这是我写的脚本
<?xml version="1.0"?>
<project name="Hello World Project" basedir="." default="info">
<property name="cms.dir" value="D:\CMS\webclient\components\CMS\Address\AddressSearch" />
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
<target name="info">
<echo>Hello World - Welcome to Apache Ant!</echo>
<fileset id="src.files" dir="${cms.dir}" casesensitive="yes">
<include name="**/*.uim"/>
<include name="**/*.properties"/>
</fileset>
<pathconvert pathsep="${line.separator}" property="sounds" refid="src.files">
</pathconvert>
<echo file="sounds.txt">${sounds}</echo>
<loadfile property="files" srcFile="./sounds.txt"/>
<for list="${files}" delimiter="," param="file1">
<sequential>
<echo>@{file1}</echo>
<checksum file="@{file1}" todir="./checksum" />
</sequential>
</for>
</target>
</project>
文件名正在正确打印但是当我使用相同的文件计算md5时,它会抛出这样的异常
BUILD FAILED
C:\build.xml:15: The following error occurred while executing this line:
C:\build.xml:18: Could not find file D:\CMS\webclient\components\CMS\Address\Add
ressSearch\CMS_addressSearchPopUp.properties
D:\CMS\webclient\components\CMS\Address\AddressSearch\CMS_addressSearchPopUp.uim
to generate checksum for.
关于此的任何帮助
答案 0 :(得分:0)
您在创建“声音”时使用新行,但使用逗号分割。
<pathconvert pathsep="${line.separator}" property="sounds" refid="src.files">
然后将其写入文件 - sounds.txt
然后读取文件,使用逗号分割。 ( “”
<for list="${files}" delimiter="," param="file1">
如果我正确理解了这个问题,你应该使用新行
进行拆分 <for list="${files}" delimiter="${line.separator}" param="file1">