ant-user mailing list archives

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

>>From: Suzanne Kramer [mailto:meanmom@tmail.com]
>>
>>Hi,  I am building a project using subant, and need to set
>>inheritall=true.  I can't override the  basedir in the sub-projects
>>though.
>>
>>Here's a test snippet.   Any help would be greatly appreciated, thanks,
>>Suzanne.
>>    
>>
>
>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

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

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

~/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 
documented
in the manual page) and for <ant/> it is true. (This is documented).

Peter

>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: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message