How to Pass parameters for a Ant script , which is invoked via shell script?

旧城冷巷雨未停 提交于 2019-12-18 10:22:39

问题


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?


回答1:


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

-DpropertyName=itsValue

For example,

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

and then

ant -Dperson="MerryPrankster" hi

yields

 [echo] Hello MerryPrankster


来源:https://stackoverflow.com/questions/6776135/how-to-pass-parameters-for-a-ant-script-which-is-invoked-via-shell-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!