Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ant if statement

Tags:

ant

Below is a snippet from my build.xml file. I want to modify 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

like image 506
blue-sky Avatar asked Dec 16 '25 22:12

blue-sky


1 Answers

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.

like image 166
skaffman Avatar answered Dec 20 '25 20:12

skaffman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!