ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sebastien Blanc <>
Subject Re: local build file with ant
Date Sat, 22 Mar 2003 19:17:15 GMT
Hi !

just to give some insigth, I've seen the following organizations that may help
you in your choice:

1. JBOSS project for instance uses a buildmagic approach with one top build.xml
that is XML - included in all sub build.xml packages so that tasks can be shared
among one project (at least) and only need lite custo at the package level.
2. XDOCLET project until recently had one top build.xml to perform the recursive
builds of the package (global build) or enable separate compilation of each
package with a build.xml - using ant calls. I think they're talking of merging
all their jar files into one, but I'm not sure how this will affect their ANT

approach 2 is still widespread a lot in corportate environment where the
organization is mainly matrixial and developers are still assigned to a specific
package dealing with specifics funtionalities, maintaining it and testing it
(J2EE jar approach as well),
then having a build master launching global builds so that during SW integration
phase the whole application can be tested with some more high level tests. this
is true this is kinda Makefile approach but some organizations are still leading

You can have a look at the following thread that gave me interesting inputs that
drove me for the final ANT setup of my project:

The conclustion I comes up with (hope that will help ;-) is that you have to
find a middle point trying to get to the ANT philosophy with our own project
organization, i.e. find the ANT ways to keep this Makefile approach if u have to
- otherwise get rid of it, and stick to a global build.xml for all packages in
the project - must it be buildmagic, recursive ant calls or proprietary custos.

I also got the remark when asking quite the same question to think about the IDE
setup and, true I had to rethink a bit my initial ANT setup (command line
oriented) when integrating with the eclipse IDE, that assumes a global
compilation for all projects because that's the way most IDE works: u want to
debug the whole application, so you need to produce the binaries from one
application, one single click. So my best advice would be, try to re-work your
ANT setup for one of these IDEs and you should get fine.


Ray Tayek wrote:

> hi, i''ve been trying to come up with a build file that lives in the
> package that it builds (imho, this seems like the appropriate place for it
> to hang out - but this is contrary to most of the examples i have seen).
> so i came up with the following build script (see below). this seems to
> sorta do what i want (and it works in netbeans except for getting the
> environment variables).
> it seems like you would want to have one of these in most packages that
> were deliverable (say as a jar) or required some extra (non-unit) testing.
> has anyone else fooled around with this idea?
> i am wondering how to build on something like this when the build script is
> at a higher level and wants to build all of the stuff below it. perhaps
> there is some ant mechanism that goes around and builds everything below
> it?. i would not object to having a build file in *every* package as that
> will keep the information on how to build close to what it is building/
> i am concerned that the includes and excludes for the javac will work ok as
> there may be a *lot* of stuff in the tree. i zipped up a simple example at
> that works on windoze and linux just in
> case anyone is interested in fooling around with it.
> does anyone have any ideas about this sort of thing?
> any pointers would be appreciated.
> thanks
> <?xml version="1.0" encoding="UTF-8"?>
> <project basedir="." default="all" name="localBuildProject">
>          <property name="" value="localBuildApp"/>
>          <property name="src.path" value="../../../.."/> <!-- ugly, but it
> only occurs once -->
>          <property environment="env"/>
>          <property name="ant.home" value="${env.ANT_HOME}"/>
>          <!-- this does not work in netbeans -->
>          <target name="init">
>                  <echo>ant.home=${ant.home}</echo>
>          </target>
>          <target name="clean" depends="init" description="Clean all build
> products.">
>                  <delete dir="classes"/>
>          </target>
>          <target name="compile" depends="init">
>                  <mkdir dir="classes"/>
>                  <javac srcdir="${src.path}" destdir="classes" debug="true"
> deprecation="true">
>                          <include name="com/tayek/foo/bar/**/*.java"/>
>                          <exclude name="com/tayek/foo/bar/**/*"/>
>                  </javac>
>          </target>
>          <target name="compileTests" depends="compile">
>                  <mkdir dir="classes"/>
>                  <javac srcdir="${src.path}" destdir="classes" debug="true"
> deprecation="true">
>                          <include name="com/tayek/foo/bar/**/*"/>
>                          <!-- **/* - does not work! -->
>                          <!--<exclude name="com/tayek/foo/bar/**/*.java"/>
> how do i exclude the normal java files? -->
>                          <classpath>
>                                  <pathelement location="d:/java/junit.jar"/>
>                          </classpath>
>                  </javac>
>          </target>
>          <target name="test" depends="compileTests" description="run the
> tests.">
>                  <junit fork="yes" printsummary="on" haltonfailure="true">
>                          <classpath>
>                                  <pathelement path="classes"/>
>                                  <pathelement
> location="${ant.home}/lib/junit.jar"/>
>                          </classpath>
>                          <formatter type="brief" usefile="false"/>
>                          <batchtest fork="yes" todir="classes">
>                                  <fileset dir="${src.path}">
>                                          <include name="**/*"/>
>                                          <exclude name="**/"/>
>                                  </fileset>
>                          </batchtest>
>                  </junit>
>          </target>
>          <target name="all" depends="test" description="Build everything
> and run the tests.">
>      </target>
> </project>
> ---
> ray tayek actively seeking mentoring or telecommuting work
> vice chair orange county java users group
> hate spam?
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View raw message