ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phil Beiler" <phil_bei...@fanniemae.com>
Subject myenv property question....
Date Thu, 02 Aug 2001 01:50:26 GMT
Why does ANT do this? How should I do this?

1. I am using the myenv.xxxxx approach to getting environment variables. I
wanted to feed conditionally set environment variables to some jUnit tests..
2. If the variable is NOT set, it puts the myenv.xxxxxx as the value of the
property, rather than setting it to null or blank.
3. Why would the code, ProjectHelper.java, replaceProperties method set the
value to property is was looking for when it is not found in the
environment?

Obviously, this is not how I should be doing this... for example...

1. if the OVERRIDE_LOG4J environment variable is not set, use the default
properties file
2. if the OVERRIDE_LOG4J environment variable is set, use that properties
files to initialize log4j

Simple, but I cannot cleanly determine if the variable is set or not.

Thanks for any help.

Phil

--------------- Output from ant ----------------------------------

Ant version 1.3 compiled on March 2 2001

Searching for build.test.xml ...
Detected Java Version: 1.3
Detected OS: Windows NT
Project base dir set to: C:\home\me\UnitTest
 [property] Loading Environment myenv.
Property ${myenv.TEST_SET} has not been set         !!!!!!!!!!!!!!
Build sequence for target `me' is [me]
Complete build sequence is [me]

me:
     [echo]
      Env Variable ${myenv.TEST_SET}


BUILD SUCCESSFUL

Total time: 1 second


--------------------------------- SIMPLE XML FILE --------------------


<?xml version="1.0"?>

<project name="test" default="me" basedir=".">

  <property name="envProps" environment="myenv" />
  <property name="env.variable"  value="${myenv.TEST_SET}"/>

  <target name="me">
     <echo>
      Env Variable ${env.variable}
     </echo>
  </target>
</project>






Mime
View raw message