ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shackelford, John-Mason" <>
Subject RE: strange behavior with antcall
Date Mon, 29 Jul 2002 14:42:20 GMT

I have come to the conclusion that the problem I was having with antcall is
either a bug in ant or a problem with the docs. The documentation for both
antcall and ant states:

You can also set properties in the new project from the old project by using
nested param tags. These properties are always passed regardless of the
setting of inheritAll. This allows you to parameterize your subprojects.

I have written a few short build files to demonstrate that this is not
always the case.

Run the following test:

$ ant -buildfile zoo.xml feed.two feed.three

This will display the properties listed in the property file as expected.

Now try:

$ ant -buildfile zoo.xml feed.two feed.three feed.two

Instead of repeating the line for animal two:

[echo] John-Mason is going to feed the tiger his favorite: people 

you will see a fourth animal mentioned:

[echo] John-Mason is going to feed the monkey (default) his favorite:
bananas (default)

This, I contend, is the bug. Instead of taking the value from the params
passed in as previously, on the second antcall from a single target the
properties are drawn from the caller's environment. 

By using inheritAll=false this behavior is illiminated. You will see this by

$ ant -buildfile zoo.xml feed.two feed.three feed.three

The third animal line is repeated as expected. While this is a viable
workaround, according to the docs when nested param tags are used, the
properties are always passed in regardless of the setting of inheritAll.

I have also enclosed zoo2.xml and zoo-callable.xml. These domonstrate that
the same bug exists when using ant instead of antcall. Use the same args:

$ ant -buildfile zoo2.xml feed.two feed.three feed.two
$ ant -buildfile zoo2.xml feed.two feed.three feed.three

If I have missed something here, please send your gentle rebuke.

John-Mason Shackelford

Software Developer
NCS Pearson - Measurement Services
2510 North Dodge St.
Iowa City, IA 52245

View raw message