Ant 属性 设置为给定目录内的文件
Ant property set to files inside given directory
我正在编写一个 ant-build 脚本,并获得了一个带有目录路径的给定变量。
我现在想使用分隔符(如“;”)将所有这些文件放入此目录中,并将其用作 属性。
<property name="connectivity.additional.jars" value="${connectivity.additional.jars.dir}" />
我尝试使用文件集,但我不确定这是否是正确的方法以及我如何将其设置为 属性 / 甚至连接文件名...
<fileset dir="${connectivity.additional.jars.dir}">
<include name="**/*.jar"/>
</fileset>
使用带有 id 的文件集是正确的方法。将它与 ant 内置属性 ${ant.refid:filesetid}
或 ${toString:filesetid}
、f.e 结合使用。 :
<project>
<fileset dir="c:/WKS/gradle-2.4/lib" id="foo">
<include name="**/*.jar"/>
</fileset>
<property name="foobar" value="${toString:foo}"/>
<!-- or -->
<property name="foobar" value="${ant.refid:foo}"/>
</project>
${ant.refid:xxx}
或 ${toString:main.xxx}
是带有 ';' 的 csv 属性
作为默认分隔符,请参阅 Ant 手册 Properties and PropertyHelpers.
我正在编写一个 ant-build 脚本,并获得了一个带有目录路径的给定变量。 我现在想使用分隔符(如“;”)将所有这些文件放入此目录中,并将其用作 属性。
<property name="connectivity.additional.jars" value="${connectivity.additional.jars.dir}" />
我尝试使用文件集,但我不确定这是否是正确的方法以及我如何将其设置为 属性 / 甚至连接文件名...
<fileset dir="${connectivity.additional.jars.dir}">
<include name="**/*.jar"/>
</fileset>
使用带有 id 的文件集是正确的方法。将它与 ant 内置属性 ${ant.refid:filesetid}
或 ${toString:filesetid}
、f.e 结合使用。 :
<project>
<fileset dir="c:/WKS/gradle-2.4/lib" id="foo">
<include name="**/*.jar"/>
</fileset>
<property name="foobar" value="${toString:foo}"/>
<!-- or -->
<property name="foobar" value="${ant.refid:foo}"/>
</project>
${ant.refid:xxx}
或 ${toString:main.xxx}
是带有 ';' 的 csv 属性
作为默认分隔符,请参阅 Ant 手册 Properties and PropertyHelpers.