You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by ba...@goodconsultants.com on 2003/12/16 18:46:41 UTC

Validating and assign variables in ant

All,

I think I send this before but unfortunately, no answers yet. So here I go 
again...

Can I validate and then assign values to properties in ant just like any shell 
scripts would?

Here is what I am trying to do:

      <property name="catalina.home" value="${system.CATALINA_HOME}"/>
      <property name="appserver.home" value="${system.JBOSS_DIST}"/>

As you can see, when the environment variable is not set, catalina.home will 
always be assigned to a string "${system.CATALINA_HOME}. What is the correct 
way to do it? 

Thanks

Barry


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: Validating and assign variables in ant

Posted by didge <di...@foundrylogic.com>.
Have you tried <fail>?

For example:
<fail message="CATALINA_HOME must be set" unless="${env.CATALINA_HOME}/>

didge

> -----Original Message-----
> From: barry@goodconsultants.com [mailto:barry@goodconsultants.com]
> Sent: Tuesday, December 16, 2003 9:47 AM
> To: Ant Users List
> Subject: Validating and assign variables in ant
> 
> 
> All,
> 
> I think I send this before but unfortunately, no answers yet. So 
> here I go 
> again...
> 
> Can I validate and then assign values to properties in ant just 
> like any shell 
> scripts would?
> 
> Here is what I am trying to do:
> 
>       <property name="catalina.home" value="${system.CATALINA_HOME}"/>
>       <property name="appserver.home" value="${system.JBOSS_DIST}"/>
> 
> As you can see, when the environment variable is not set, 
> catalina.home will 
> always be assigned to a string "${system.CATALINA_HOME}. What is 
> the correct 
> way to do it? 
> 
> Thanks
> 
> Barry
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org