How to Pass parameters for a Ant script , which is

2019-01-31 11:02发布

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条回答
等我变得足够好
2楼-- · 2019-01-31 12:04

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
查看更多
登录 后发表回答