开发者

How to pass a variable number of arguments to ant exec

开发者 https://www.devze.com 2023-03-22 01:08 出处:网络
I have a ant target that takes a variable number of arguments that are to be passed to an exec task. Using the old mechanism it is trivial:

I have a ant target that takes a variable number of arguments that are to be passed to an exec task. Using the old mechanism it is trivial:

<exec command="cmd /c ${_full-path-to-exec}" osfamily="windows" failonerror="true">
</exec>

However, use of 'command' is deprecated i开发者_开发知识库n favor of nested elements. like this:

<exec executable="cmd" osfamily="windows" failonerror="true">
    <arg value="/c"/>
    <arg file="${_full-path-to-exec}"/>
    <arg value="${_param-one}"/>
    <arg value="${_param-two}"/>
    <arg value="${_param-three}"/>
</exec>

which makes variable argument lists impossible.

How to solve this problem?


How about this:

 <arg line="whatever args you need"/>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号