ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesse Glick <>
Subject Re: if basedir absolute file name then resolving file names causes duplicate basedirs in resulting string
Date Fri, 18 Aug 2000 14:52:26 GMT
Kitching Simon wrote:
> I have a set of projects that I need to build, most of which can be build
> with
> just a couple of different build.xml files. So I put these commonly-used
> buildfiles
> in a common directory, then just have something like:
> <ant dir="srcdir1" antfile="${buildfiledir}/buildclasses.xml" />
> <ant dir="srcdir2" antfile="${buildfiledir}/buildclasses.xml" />
> <ant dir="srcdir3" antfile="${buildfiledir}/buildapplet.xml" />
> <ant dir="srcdir4" antfile="${buildfiledir}/buildapplet.xml" />

I see your point, but disagree that this should be the normal behavior.
In your example, I would think that it would be more natural, if a
little cumbersome, to write <property name="basedir"
value="${basedir}/srcdir1"/> inside the Ant tasks, to make it explicit
that your intent is to set the basedir of the subproject differently
depending on how it is called. (Does this in fact work? Probably not at
the moment.) But I feel the default should be that basedir attributes of
subprojects should be taken at face value. Currently there is no way to
honor them; if subprojects have non-"." basedirs, you must know in the
master script what they are, and remember to take that into account.
Also the current behavior is not analogous to the ant commandline syntax
which is uncomfortable.

Can you think of a decent compromise? Perhaps an attribute
basedir="srcdir1" to <ant> to explicitly override the subproject's
basedir, with 'dir' meaning only "directory of the ant script"? Or can
subprojects use variable substitution in their 'basedir' attribute? Or
make the subproject's basedir set according to its wishes relative to
its containing directory, if <ant> has no 'dir' attribute (but then the
behavior is different with dir=".")? Also in your case you could simply
pass in a ${topdir} or similar variable to the subproject, to be used in
all paths, but of course this is less convenient than basedir.

I definitely agree that if the behavior should be left as is, the
documentation should be clearer on how it works as you suggested.


Jesse Glick   <>
NetBeans, Open APIs  <>
tel (+4202) 3300-9161 Sun Micro x49161 Praha CR

View raw message