tags:

views:

34

answers:

1

Hi All,

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

+1  A: 

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.

skaffman
Thanks, I'll give that a try
I tried the following but it's throwning and error, am I using it correctly ? <if> <equals arg1="${foo}" arg2="bar" /> <then> jarName="${polish.vendor}-${polish.name}-${polish.locale}-FAMA.jar" </then> <else> jarName="${polish.vendor}-${polish.name}-${polish.locale}-FAMA.jar" </else> </if>
@user470184: Edit your question, or start a new one, rather than putting such things in as comments.
skaffman