You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Michael Baker <mi...@scmlabs.com> on 2002/08/28 16:24:08 UTC
Building Multiple Projects with one build.xml
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
Re: Building Multiple Projects with one build.xml
Posted by Laurie Harper <zo...@holoweb.net>.
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" <mi...@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: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>