ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frode E. Moe" <fr...@CoreTrek.no>
Subject <import> and properties weirdness
Date Thu, 30 Sep 2004 13:59:57 GMT
Hi!

I am currently experiencing some weirdness when using multiple levels of
imported build files. The issue boils down to properties not being set,
when I expect them to be. I am puzzled, because the ant manual for
<import> says that <import> is basically the same as a copy&paste job.

I'm attaching four build files; the first three (part1, part2, part3) 
works together, while the fourth (concat.xml) is simply a copy&paste
job (excluding the <project> tags). 

Running "ant -f part3.xml release" produces:

Buildfile: part3.xml
     [echo] 
     [echo]     dir.src is ${dir.src}
     [echo]     dir.srcphp is ${dir.src}/php
     [echo]   

release:
     [echo] 
     [echo]     dir.src is src
     [echo]     dir.srcphp is ${dir.src}/php
     [echo]   

release.prepare:
     [echo] 
     [echo]     dir.src is src
     [echo]     dir.srcphp is ${dir.src}/php
     [echo]   

BUILD SUCCESSFUL
Total time: 0 seconds

Running what I would assume to be equivalent, "ant -f concat.xml
release" produces this instead:

Buildfile: concat.xml
     [echo] 
     [echo]     dir.src is src
     [echo]     dir.srcphp is src/php
     [echo]   

release:
     [echo] 
     [echo]     dir.src is src
     [echo]     dir.srcphp is src/php
     [echo]   

release.prepare:
     [echo] 
     [echo]     dir.src is src
     [echo]     dir.srcphp is src/php
     [echo]   

BUILD SUCCESSFUL
Total time: 0 seconds

Note how ${dir.src} is not defined in the first version, but is defined
in the second version. So when "dir.srcphp" is constructed, it actually
becomes the literal value "${dir.src}/php" instead of "src/php".

Now observe what happens if you edit part2.xml and takes out the empty
and not-referenced target "usage": 

% ant -f part3.xml release
Buildfile: part3.xml
     [echo] 
     [echo]     dir.src is src
     [echo]     dir.srcphp is src/php
     [echo]   

release:
     [echo] 
     [echo]     dir.src is src
     [echo]     dir.srcphp is src/php
     [echo]   

release.prepare:
     [echo] 
     [echo]     dir.src is src
     [echo]     dir.srcphp is src/php
     [echo]   

BUILD SUCCESSFUL
Total time: 0 seconds


Apparently the empty and unreferenced target "usage" causes ${dir.src}
not to be set when using the 3-file import construct, but not when
concatenating. 

Any ideas?

output of "ant -v":
% ant -v
Apache Ant version 1.6.2 compiled on July 16 2004
Buildfile: build.xml does not exist!
Build failed

output of "java -version":
% java -version
java version "1.4.2_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04)
Java HotSpot(TM) Client VM (build 1.4.2_05-b04, mixed mode)


- Frode



Mime
View raw message