blue-sky
blue-sky

Reputation: 53896

Ant if statement

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

Upvotes: 3

Views: 5975

Answers (1)

skaffman
skaffman

Reputation: 403611

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.

Upvotes: 3

Related Questions