Can someone please explain this bizarre behavior to me?  I can't for the life
of me figure out why this condition is evaluating to "true", especially
since just before that I'm logging the value of the property.

build.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project name="Simple" default="build" basedir=".">

        <description>Test file for weird build bug.</description>
        
        <property environment="env"/>
        
        <target name="env-fail-check" depends="env-help" 
if="env-error-condition">
        
                <echo message="Value of env-error-condition: 
${env-error-condition}"/>                  
                <fail message="One or more required environment variables are 
not set. 
Please check the output of ant target env-help."/>
                
        </target>
        
        <target name="env-help" description="Help description of env variables">
                <echo message="The following variables must be set in your 
environment:"/>
                <echo message="AXIS_HOME                : Directory where 
apache axis is installed. 
e.g. C:/axis-1_4"/>
                <antcall target="env-info"/>
        </target>
        
        <target name="env-info" description="Prints env settings">
                <echo message="ant.project.name                 =  
${ant.project.name}"/>
                <echo message="AXIS_HOME                                =       
${env.AXIS_HOME}"/>
        </target>
        
        <target name="init">
        
                <condition property="env-error-condition">
                        <not>
                                <isset property="${env.AXIS_HOME}"/>
                        </not>                          
                </condition>
                
                <echo message="Value of env-error-condition: 
${env-error-condition}"/>                  

                <antcall target="env-fail-check"/>
                
        </target>
        
        <target name="build" description="Build target" depends="init">
                <!-- do some stuff here -->
        </target>
        
</project>

Execution:

[EMAIL PROTECTED] MdmProxy
$ echo $AXIS_HOME
C:\axis-1_4
[EMAIL PROTECTED] MdmProxy
$ ant -f build-simple.xml
Buildfile: build-simple.xml

init:
     [echo] Value of env-error-condition: true

env-help:
     [echo] The following variables must be set in your environment:
     [echo] AXIS_HOME  : Directory where apache axis is installed.  e.g.
C:/axis
-1_4

env-info:
     [echo] ant.project.name   =  Simple
     [echo] AXIS_HOME    = C:\axis-1_4

env-fail-check:
     [echo] Value of env-error-condition: true

BUILD FAILED
c:\home\sfisher\Genentech\MdmProxy\build-simple.xml:36: The following error
occu
rred while executing this line:
c:\home\sfisher\Genentech\MdmProxy\build-simple.xml:11: One or more required
env
ironment variables are not set.  Please check the output of ant target
env-help.
-- 
View this message in context: 
http://www.nabble.com/Strange-Condition-Evaluation-Bug--tp20368618p20368618.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to