You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Bi...@mail.sprint.com on 2001/05/08 01:26:17 UTC

RE: newbie - subproject question -- followup question

Ok, in addition to my first question, here's my next 
observation/question.  Given the following xml, if invoked like 
`build`
I get what I expect - the main of MasterBuild executes.  It depends on 
SubBuild1 which calls sub.xml  When it enters sub.xml, it looks at the 
project stuff, sees its default and goes to it.  It was my original 
assumption that it'd look for the same target that called it (i.e. 
target SubBuild1 invokes sub.xml telling it to start with SubBuild1)  
This was an erroneous assumption.  To make it do that, the ant call 
would have to have a target defined (see SubWorks)  
What I'd love to hear is that I can know what target I'm in.  Anybody 
want to tell me that?  ;)  I'd like to be able to say <ant 
antfile="z.xml" target="${ant.current.target}" />  

Any suggestions?

/bill


<project name="MasterBuild" default="main" basedir=".">
  <target name="main" depends="SubBuild1">
  </target>

  <target name="SubBuild1">
    <ant antfile="sub.xml" />
  </target>

  <target name="Sub">
    <ant antfile="sub.xml" />
  </target>

  <target name="SubWorks">
    <ant antfile="sub.xml" target="Sub"/>
  </target>

</project>

<project name="SubBuild1" default="main" basedir=".">
  <target name="main" depends="SubBuild1">
  </target>

  <target name="SubBuild1">
    <echo message="I am SubBuild1" />
  </target>

  <target name="Sub">
    <echo message="I am not SubBuild1" />
  </target>
</project>