ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Lenz <>
Subject Conditionally passing property to <ant>
Date Tue, 29 Apr 2003 10:57:47 GMT
Hi folks,

I'd like to call another build file with a set of optional properties. 
If defined, those properties point to directories. In addition, I cannot 
use property inheritance.

The naive attempt

   <ant dir="${the.dir}" inheritAll="false">
     <property name="mydir" value="${mydir}"/>

works fine if 'mydir' has been defined, but of course fails when it 
hasn't -- because the property is set to the literal ${mydir}. The 
called script checks whether the property has been set, and only 
executes some tasks if it has.

So what I'd need would basically be:

   <ant dir="${the.dir}" inheritAll="false">
     <property name="mydir" value="${mydir}" if="mydir"/>

Any ideas?


View raw message