将文件中的内容作为ant中的参数加载
假设我有一个文件test.key,该文件包含一个字符串let call“123456789”。 如何将此文件作为参数传递给ant build中的程序? 我想知道这样的事情是否可能? ant-Darg='cat test.key'将文件中的内容作为ant中的参数加载,ant,Ant,假设我有一个文件test.key,该文件包含一个字符串let call“123456789”。 如何将此文件作为参数传递给ant build中的程序? 我想知道这样的事情是否可能? ant-Darg='cat test.key' 其中cat test.key是Linux终端上的一个命令。您可以使用LoadFile ant任务,该任务将文件内容读入属性: 因此,LoadFile任务变为: <loadfile property="arg.value" srcFile="$
其中cat test.key是Linux终端上的一个命令。您可以使用LoadFile ant任务,该任务将文件内容读入属性: 因此,LoadFile任务变为:
<loadfile property="arg.value"
srcFile="${file.name}"
failonerror="false"/>
<exec executable="myprogram">
<arg value="${arg.value}"/>
</exec>
ant -Dfile.name=test.key
<loadfile property="arg.value"
srcFile="${file.name}"
failonerror="false"/>