Java Mailing List Archive

http://www.ant-tasks.com/

Apache Ant Archive

» Ant Users List
» Ant Developers List
Mysterious SubAnt behaviour [possible SubAnt bug?]

Mysterious SubAnt behaviour [possible SubAnt bug?]

2004-01-09       - By Clifton C. Craig
Reply:     1     2  

I'm still having trouble with this mysterious behavior with the new
SubAnt task. I have a temporary work-around involving a windows batch
file but it is not ideal. I'd like to be able to call my build from
within an automated process written in Ant and have it behave the same
as it does from the command-line. Should this be submitted as a bug or
am I doing something wrong. I've tried every different incarnation I can
think of for achieving the desired behavior but nothing works.

-------- Original Message --------
Subject:   Re: Including files in a dirset - mysterious SubAnt behavior
Date:   Fri, 02 Jan 2004 15:45:06 -0500
From:   Clifton C. Craig <ccc@(protected)>
Reply-To:   Ant Users List <user@(protected)>
To:   Ant Users List <user@(protected)>
References:   <3FF5CAF2.5070406@(protected)>



Ok this is spooky. I have a build that calls several builds in it's sub
directories via SubAnt. The sub-builds should run with their basedir set
to the folder they are located in. If I call the main build directly
from the command line all is fine. However, if I call the main build
from another build (as part of an automated process) then all of the
main build's sub build's basedirs are set to the basedir of the main
build. I thought that using a dirset would rectify the problem but it
doesn't. Can anyone help me figure out why the strange behaviour? A
simplified example is as such:

automated-build.xml:
  <!-- this build is located in the ${project.base}/tools/scripts dir
  <target name="clean-build" depends="init">
      <ant dir="${project.base}" antfile="main-build.xml" target="default"
          output="${log.dir}\nightly-build.log"/>
  </target>

main-build.xml:
  <!-- this build is located in the ${project.base} dir defined
elsewhere...
  <target name="default" depends="init">
      <subant inheritall="false" inheritrefs="true"
          failonerror="${fail.on.error}">
           <!-- ${project.src} is the src folder under ${project.base}
or ${project.base}/src -->
          <dirset dir="${project.src}" includes="/**">
              <!-- includes.selector is a custom selector that
includes only folders that contain build.xml -->
              <selector refid="includes.selector"/>
          </dirset>
          <propertyset>
              <propertyref regex=".*"/>
          </propertyset>
      </subant>
  </target>

If I run main-build.xml from the command-line all build.xmls selected by
subant run with their basedir set to their contained folder. However,
when I run automated-build.xml all of the build.xmls under
${project.src} run with their basedir set to ${project.base} which is
the basedir of main-build.xml. (This, of course causes them to crash
since they all use paths relative to their basedir.) What's the deal?



Earlier I wrote:

> How does a dirset act when one of its patternsets includes a file?  
> What I'm looking for is a way to include all sub-directories of a
> given directory that contain build.xml so I can pass it off to SubAnt.
> I was originally using a fileset but it caused a tricky error where
> the basedir of the build file was being set to the basedir of the
> calling target. I want the basedir of the build xmls to be set to the
> folder they are found in. I was thinking that I could change my
> fileset to a dirset which should implicitly set the basedir of all
> located build xmls to the folder they located in. However I don't see
> a straight foward way to do this with a dirset. I have a custom
> selector that I could use but I was wondering if there was a pattern
> expression that would be work as well. For example, if I use <include
> name="**/build..xml"> in a dirset would this give me a set of all sub
> folders that have build.xml or would it give me an error or what?
>
> Cliff
>
> Clifton C. Craig, Software Engineer
> Intelligent Computer Systems -  A Division of GBG
> 2101 Embassy Drive
> Lancaster, PA  17603
>
> Phone:  717-295-7977 ext. 621
> Fax:  717-295-7683
> ccc@(protected)
> ccraig@(protected)
>
> ****************************************************************************
>
> Mark the dates: February 22-25, 2004 at the Aladdin Hotel & Casino in Las
> Vegas, NV.
> GBG is pleased to announce the premier event for sales and distribution
> software solutions for soft drink, beer, water, snack, candy & tobacco
> organizations - Encounter 2004: GBG's 2nd Annual User Conference!
> Register by December 15th and receive early bird rates:
> http://www.globalbeveragegroup.com/postings/user_conf_2004_announcement.htm
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>
>
> Clifton C. Craig, Software Engineer
> Intelligent Computer Systems -  A Division of GBG
> 2101 Embassy Drive
> Lancaster, PA  17603
>
> Phone:  717-295-7977 ext. 621
> Fax:  717-295-7683
> ccc@(protected)
> ccraig@(protected)
>
> ****************************************************************************
> Mark the dates: February 22-25, 2004 at the Aladdin Hotel & Casino in Las
> Vegas, NV.
> GBG is pleased to announce the premier event for sales and distribution
> software solutions for soft drink, beer, water, snack, candy & tobacco
> organizations - Encounter 2004: GBG's 2nd Annual User Conference!
> Register by December 15th and receive early bird rates:
> http://www.globalbeveragegroup.com/postings/user_conf_2004_announcement.htm
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)





--
Clifton C. Craig, Software Engineer
Intelligent Computer Systems -  A Division of GBG
2101 Embassy Drive
Lancaster, PA  17603

Phone:  717-295-7977 ext. 621
Fax:  717-295-7683
ccc@(protected)
ccraig@(protected)
****************************************************************************


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)



©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.