ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergei Dubov <sdu...@gmail.com>
Subject Re: Again: Checking for non-existence of environment variable
Date Tue, 24 Jan 2006 22:29:42 GMT
Sorry, it's been a really long day I guess. I appreciate your help. It 
all works.

-Serge

Burgess, Benjamin wrote:
> You keep adding the ${} when only the property name is required.
> 
> I assure you that all you need is this - just copy and paste it and
> test:
> 
> <fail unless="env.DAVINCI_EXT" message="DAVINCI_EXT environment variable
> has not been set!"/>
> 
> Ben
> 
> -----Original Message-----
> From: Sergei Dubov [mailto:sdubov@gmail.com] 
> Sent: Tuesday, January 24, 2006 5:02 PM
> To: Ant Users List
> Subject: Again: Checking for non-existence of environment variable
> 
> I think this is finally what I've been struggling with. It doesn't seem 
> to work when the env variable actually exists. Here is my macro:
> 
> =============================
> <macrodef name="check-for-ext">
>          <sequential>
>              <echo>${env.DAVINCI_EXT}</echo>
>              <fail>
>                  <condition>
>                      <not>
>                          <isset property="${env.DAVINCI_EXT}"/>
>                      </not>
>                  </condition>
>                  Cause:
>                  DAVINCI_EXT environment variable has not been set!
>              </fail>
>          </sequential>
> </macrodef>
> ================================
> 
> And here is what I get trying to invoke it from basic task:
> 
> ===========================================================
> 
> serge@velocity ~/work/davinci-dev/davinci-master
> $ echo $DAVINCI_EXT
> serge
> 
> serge@velocity ~/work/davinci-dev/davinci-master
> $ ant -f setup-user.xml setup-home
> Buildfile: setup-user.xml
> 
> setup-home:
>       [echo] serge
> 
> BUILD FAILED
> C:\Documents and Settings\serge\My 
> Documents\work\davinci-dev\davinci-master\setup-user.xml:91: The 
> following error occurred while executing this line:
> C:\Documents and Settings\serge\My 
> Documents\work\davinci-dev\davinci-master\setup-user.xml:201: Cause:
>                  DAVINCI_EXT environment variable has not been set!
> 
> Total time: 0 seconds
> ========================================================================
> 
> I am using Cygwin on WinXP. Ant is 1.6.5.
> 
> Any ideas would be really appreciated.
> 
> Thanks again,
> 
> -Serge
> 
> 
> 
> 
> 
> Matt Benson wrote:
> 
>>uh... no.  Try it.  Then reread
>>http://ant.apache.org/manual/CoreTasks/fail.html .
>>
>>-Matt
>>
>>--- Sergei Dubov <sdubov@gmail.com> wrote:
>>
>>
>>
>>>The whole point is that ${env.NO_VALUE} will return
>>>${env.NO_VALUE} as 
>>>its value if it doesn't exist...
>>>
>>>-Serge.
>>>
>>>Burgess, Benjamin wrote:
> 
> 
>>>>Will <fail unless="env.NO_VALUE"/> work for you?
>>>>
>>>>Ben
>>>>
>>>>-----Original Message-----
>>>>From: Sergei Dubov [mailto:sdubov@gmail.com] 
>>>>Sent: Tuesday, January 24, 2006 3:48 PM
>>>>To: user@ant.apache.org
>>>>Subject: Checking for non-existence of environment
>>>
>>>variable
>>>
>>>
>>>>Hi guys,
>>>>
>>>>I am sure this question has been asked before. But
>>>
>>>I did my research and
>>>
>>>
>>>>found no answers whatsoever.
>>>>
>>>>Basically I am trying to check for existence of an
>>>
>>>environment variable.
>>>
>>>
>>>>And if it is not defined I want the script to
>>>
>>>fail.
>>>
>>>
>>>><project name="base" basedir="."
>>>
>>>default="echo-env">
>>>
>>>>    <property environment="env"/>
>>>>
>>>>    <target name="echo-env">
>>>>        <echo>${env.NO_VALUE}</echo>
>>>>    </target>
>>>></project>
>>>>
>>>>Basically this will return "${env.NO_VALUE}".
>>>>
>>>>And potential <available> check will think it
>>>
>>>actually HAS value. Is 
>>>
>>>
>>>>there any way to make Ant recognize that
>>>
>>>System.getenv("NO_VALUE") 
>>>
>>>
>>>>returns null?
>>>>
>>>>Thank you very much beforehand,
>>>>
>>>>Serge.
>>>>
>>>>
>>>
>>---------------------------------------------------------------------
>>
>>
>>>>To unsubscribe, e-mail:
>>>
>>>user-unsubscribe@ant.apache.org
>>>
>>>
>>>>For additional commands, e-mail:
>>>
>>>user-help@ant.apache.org
>>>
>>>
>>>>
>>>>
>>**************************************************************
>>
>>
>>>>This message, including any attachments, contains
>>>
>>>confidential information intended for a specific
>>>individual and purpose, and is protected by law.  If
>>>you are not the intended recipient, please contact
>>>sender immediately by reply e-mail and destroy all
>>>copies.  You are hereby notified that any
>>>disclosure, copying, or distribution of this
>>>message, or the taking of any action based on it, is
>>>strictly prohibited.
>>>
>>>
>>>>TIAA-CREF
>>>>
>>>
>>**************************************************************
>>
>>
>>>>
>>---------------------------------------------------------------------
>>
>>
>>>>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
>>>
>>>
>>
>>
>>
>>__________________________________________________
>>Do You Yahoo!?
>>Tired of spam?  Yahoo! Mail has the best spam protection around 
>>http://mail.yahoo.com 
>>
>>---------------------------------------------------------------------
>>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
> 
> 
> 
> **************************************************************
> This message, including any attachments, contains confidential information intended for
a specific individual and purpose, and is protected by law.  If you are not the intended recipient,
please contact sender immediately by reply e-mail and destroy all copies.  You are hereby
notified that any disclosure, copying, or distribution of this message, or the taking of any
action based on it, is strictly prohibited.
> TIAA-CREF
> **************************************************************
> 
> 
> ---------------------------------------------------------------------
> 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


Mime
View raw message