ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laurie Harper <zod...@holoweb.net>
Subject Re: Building Multiple Projects with one build.xml
Date Thu, 29 Aug 2002 23:35:24 GMT
I'm trying to solve the same problem and have it mostly working; the only
problem I can't solve is to allow a task for one sub-project depend on a
task for another.

Apart from that, it's pretty easy. Just use a build.xml that loads a
properties file and make all your worker tasks use properties exclusively.
For example:

    <project name="master build" default="all">
        <properties file="${component.properties}/>

        <target name="all" depends="compile,jar,..."/>

        <init>
            <classpath id="classpath">
                <fileset dir="${dir.lib}">
                    <include name="**/*.jar"/>
                </fileset>
            </classpath>
        </init>

        <target name="compile" depends="init">
            <javac
                srcdir="${dir.src}"
                destdir="${dir.build}"
                classpathref="classpath"
                includes="net/**/*.java"
            />
        </target>

        ...

    </project>

Invoke ant with 

    ant -Dcomponent.properties=path-to-component.properties ...

Each component's properties file defines properties the build.xml needs, for
example:

    dir.build=build/component1
    dir.lib=component1/lib
    dir.src=component1/src

You could get fancy by using ant-contrib's 'foreach' class to build all of
your components by searching for their properties files.

L.

On 8/28/02 10:24 AM, "Michael Baker" <mike@scmlabs.com> wrote:

> Hi everybody.
> 
> I have many Java projects with many separated build.xmls.  I would like to
> create a template build.xml that uses a property file for necessary
> properties.
> 
> My question.  Is it possible to call the jar task many times based on a set of
> properties?  I would like to be able to build all of my Java projects with one
> build.xml and one property file.  I am familiar with setting up the property
> file, but not sure what to do in build.xml (I only want to have one javac
> task, jar task, etc).
> 
> In a scripting language I would:
> 
> for each property (in jar section of file)
>  create jar 
> next
> 
> Is this possible in Ant?
> 
> Thanks for any help.
> 
> Mike
> 


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


Mime
View raw message