如何为通过 shell 脚本调用的 Ant 脚本传递参数? [英] How to Pass parameters for a Ant script , which is invoked via shell script?

查看:35
本文介绍了如何为通过 shell 脚本调用的 Ant 脚本传递参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要通过 shell 脚本调用一个 ant 脚本.让我们考虑蚂蚁脚本的参数是 a,b,c.我如何传递这些变量的参数?我必须提供 ant vis 调用 shell 脚本的参数.有人可以帮我吗?

I need to invoke a ant script via shell script. Let us consider the parameters for ant script are a,b,c. how can i pass the parameter for those variables? I must provide the parameters for ant vis invoke the shell script. can anyone help me on this?

推荐答案

你的意思是从命令行给属性赋值吗?如果是这样,请尝试

Do you mean assigning value to a property from command line? If so, try

-DpropertyName=itsValue

例如

<project>
    <target name="hi">
        <property name="person" value="world"/>
        <echo message="Hello ${person}"/>
    </target>
</project>

然后

ant -Dperson="MerryPrankster" hi

收益

 [echo] Hello MerryPrankster

这篇关于如何为通过 shell 脚本调用的 Ant 脚本传递参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆