ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Reilly <peterrei...@apache.org>
Subject Re: basedir not set corretly in subant task...
Date Thu, 15 Jul 2004 12:11:46 GMT
This is easy to explain and it is is the manal  ;-)

Using the <ant dir="x"/> will set the basedir as a user-like property, 
which means that
it cannot be overwitten subsequently - i.e. it gets "frozen".

You need to use : <ant antfile="x/build.xml" inheritall="no"/> which 
will set basedir property
as a non-user-like property.

Peter

Steve Loughran wrote:

>
> I have a problem w/ ant and subant that does not involve basedir being 
> set ; in smartfrog.org CVS for people who are curious, but I havent 
> checked this stuff fully in yet because it doesnt work.
>
>
> Directory core/  at the base of things
>
>
>    <target name="diag2" depends="init" >
>     <ant dir="${components.project}" target="diag2" inheritAll="false" />
>   </target>
>
> Directory core/components/
>
>     <path id="component.path">
>       <pathelement location="${utils.project}"/>
>       <pathelement location="${logger.project}"/>
>     ...
>     </path>
>     <presetdef name="delegate">
>       <subant buildpathref="component.path"
>         antfile="build.xml"
>         inheritall ="false"
>     inheritrefs="false"/>
>     </presetdef>
> </target>
>
>   <target name="diag2" depends="init"
>     description="diagnostics">
>     <delegate target="diag2"/>
>   </target>
>
> So we set up a list of sub projects, a preset to do the delegation, 
> then invoke it for our diagnostics "diag2" target
>
> directory core/components/utils
>
> <?xml version="1.0"?>
> <project name="utils" default="default" basedir=".">
>   <property file="build.properties" />
>   <echo>base dir ${basedir}</echo>
>
>   <property name="root.dir" location="../.."  />
>     <!-- Import common stuff -->
>   <import file="${root.dir}/common.xml"/>
> </project>
>
>
>
> 1. everything works in components
> cd core/components; ant diag2
>
> init-common:
>      [echo] In project logger
>
> init-standard-output-dirs:
>
> use-smartfrog-tasks:
>
> init:
>
> diag2:
>      [echo]
>      [echo]       build file logger
>      [echo]       base dir 
> /home/slo/Projects/SmartFrog/Forge/core/components/logger
>      [echo]
>
> 2. everything breaks when called from the core
>
> chamonix:components> cd ..
> chamonix:core> ant diag2
> Buildfile: build.xml
>
> init:
>
> diag2:
>
> init:
>
> diag2:
>      [echo] base dir /home/slo/Projects/SmartFrog/Forge/core/components
>
> BUILD FAILED
> /home/slo/Projects/SmartFrog/Forge/core/build.xml:42: The following 
> error occurred while executing this line:
> /home/slo/Projects/SmartFrog/Forge/core/components/build.xml:145: The 
> following error occurred while executing this line:
> /home/slo/Projects/SmartFrog/Forge/core/components/utils/build.xml:37: 
> Cannot find /home/slo/Projects/SmartFrog/Forge/common.xml imported 
> from /home/slo/Projects/SmartFrog/Forge/core/components/utils/build.xml
>
> -------------------------
>
> What is going on here? It looks like the basedir is being frozen at 
> the destination for the <ant> call; the subsidiary <subant> call is 
> running with the wrong base dir. Either I am calling subant wrongly, 
> or something is going wrong. Note that I have inheritance turned off 
> on both invocations
>
> -steve
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>
>
>


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


Mime
View raw message