Ant if statement
Below is a snippet from my build.xml
file.
I want to modify 开发者_JAVA百科the file so that the jar name is set depending on the value of a variable within the build file.
<info
jarName="java get"
jarUrl="${deploy-url}${polish.jarName}"
/>
So something like -
<info
if(${deploy-url} == "test")
jarName="java get"
else
jarName="java test"
jarUrl="${deploy-url}${polish.jarName}"
/>
Or can I call a java program to return the jar name, so something like -
<info
jarName=java programToExecute
jarUrl="${deploy-url}${polish.jarName}"
/>
Thanks for any suggestions,
Adrian
The Ant Contrib project has a selection of custom tasks, including an <if>
task that will let you do this. It's clumsy, but it works.
精彩评论