You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by gengyun <ge...@sei.pku.edu.cn> on 2010/07/19 04:03:11 UTC
problem while using enviroment attributes
hi
thx for answering my question
I was wondering how to judge whether a enviroment attribute is set or not, I tried the <condition> task, but I can't find a proper nested element to do the right work. for example I 've tried:
<property enviroment="env"/>
<property name="java.enviroment" value="${env.JAVA_HOME}"/>
<condition property="java.enviroment.isset">
<and>
<isset property="java.enviroment"/>
</and>
</condition>
but the property "java.enviroment" will be set no matter the JAVA_HOME is set or not. If set ,it will be the correct path to java-home-dir. but if not ,then it will be string "${env.JAVA_HOME}" and the condition property "java.enviroment.isset" will also be "true".
I also tried <istrue> <available> but none of them seem to work, plz help thx a lot!
2010-07-19
gengyun
AW: problem while using enviroment attributes
Posted by Ja...@rzf.fin-nrw.de.
This works for me:
<project>
<property environment="env"/>
<condition property="isset">
<isset property="env.JAVA_HOME"/>
</condition>
<echo>
isset: ${isset}
JAVA_HOME: ${env.JAVA_HOME}
</echo>
</project>
But beware of case sensitivy of the env variable: JAVA_HOME != java_home
Jan
>-----Ursprüngliche Nachricht-----
>Von: gengyun [mailto:gengyun@sei.pku.edu.cn]
>Gesendet: Montag, 19. Juli 2010 04:03
>An: user
>Betreff: problem while using enviroment attributes
>
>hi
>
>thx for answering my question
>
>I was wondering how to judge whether a enviroment attribute is
>set or not, I tried the <condition> task, but I can't find a
>proper nested element to do the right work. for example I 've tried:
>
><property enviroment="env"/>
><property name="java.enviroment" value="${env.JAVA_HOME}"/>
><condition property="java.enviroment.isset">
> <and>
> <isset property="java.enviroment"/>
> </and>
></condition>
>
>but the property "java.enviroment" will be set no matter the
>JAVA_HOME is set or not. If set ,it will be the correct path
>to java-home-dir. but if not ,then it will be string
>"${env.JAVA_HOME}" and the condition property
>"java.enviroment.isset" will also be "true".
>
>I also tried <istrue> <available> but none of them seem to
>work, plz help thx a lot!
>
>
>2010-07-19
>
>
>
>gengyun
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org