ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Reilly <>
Subject Re: Subant: can't override basedir in subproject
Date Thu, 25 Mar 2004 10:28:41 GMT
Dominique Devienne wrote:

>>From: Suzanne Kramer []
>>Hi,  I am building a project using subant, and need to set
>>inheritall=true.  I can't override the  basedir in the sub-projects
>>Here's a test snippet.   Any help would be greatly appreciated, thanks,
>Basedir is not a usual property that you can inherit.
This is not complely correct.
If one sets the inheritall to  true/yes, the basedir property is 
inherited and this
overrides the basedir of the build files called by subant.

For example:
~/learning/a/subdir : build.xml

  <property name="inherit" value="no"/>
  <subant target="" antfile="build.xml" inheritall="${inherit}">
    <dirset dir="." includes="subdir"/>

~/learning/a/subant/subdir : build.xml
  <echo>subdirs Basedir is ${basedir}</echo>

~/learning/a/subant> ant
Buildfile: build.xml
     [echo] subdirs Basedir is /home/preilly/learning/a/subant/subdir

~/learning/a/subant> ant -Dinherit=yes
Buildfile: build.xml
     [echo] subdirs Basedir is /home/preilly/learning/a/subant

This is probally not a good thing. <ant/> has the same issue,
but it does allow the user to set the basedir property of the
called project by using the "dir" attribute.

A work-around would be to set inheritall to false, and pass the
needed properties by using nested property or propertyset elements.

Note that the default value of inheritall for <subant/> is false, (not 
in the manual page) and for <ant/> it is true. (This is documented).


>I could be wrong, but <subant>, unlike <ant> doesn't
>allow you to override the basedir of the project called,
>which is a good thing IMHO.
>The point of subant, at least as I designed it, was to delegate part of
>the build's work to a sub-process that deals specifically with something
>more localized than the overall builds. For example, my main builds
>always delegate the building of native JNI libs to a sub-build.
>I never ever declare absolute basedirs, and never override the basedir,
>either with <ant> or <subant> (again, I'm not sure it's possible with
>the latter). --DD
>To unsubscribe, e-mail:
>For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message