I came up with a pattern that uses one target to do the compile and
then other targets use antcall to invoke it, like this:
<!-- ==================================================================== -->
<!-- Generic compilation target - uses javac.patternset to control -->
<!-- what gets compiled -->
<!-- ==================================================================== -->
<target name="generic-compile">
<javac srcdir="${src.dir}"
destdir="${build.lib}"
debug="${debug}"
deprecation="${deprecation}"
optimize="${optimize}"
failonerror="yes"
depend="yes"
includeAntRuntime="no" >
<bootclasspath refid="rt.path" />
<classpath refid="base.path" />
<patternset refid="${javac.patternset}" />
</javac>
</target>
<!-- ==================================================================== -->
<!-- Compile everything at once -->
<!-- ==================================================================== -->
<target name="compile"
depends="prepare-build"
description="Compile ALL classes at once" >
<antcall target="generic-compile">
<param name="javac.patternset" value="le.paths.all"/>
</antcall>
</target>
<!-- ==================================================================== -->
<!-- Compile the utility classes -->
<!-- ==================================================================== -->
<target name="compile-util"
depends="prepare-build"
description="Compile the utility classes" >
<antcall target="generic-compile">
<param name="javac.patternset" value="le.paths.util"/>
</antcall>
</target>
Stefan Bodewig wrote:
>
> On Wed, 11 Jul 2001, Steffen Euch <[EMAIL PROTECTED]> wrote:
>
> > Is it possible to set the attributes (classpath, debug, deprecation,
> > failonerror, ...) for several <javac> tasks all at once?
>
> Ant2 is supposed to provide a way in form of user preferences (no, no
> implementation and no schedule yet 8-). This means you can give
> default values for attributes that have not been specified explicitly.
>
> > Or is there an ant feature that can be used like the C-preprocessor,
> > to automatically replace text with other text (e.g. attributes for a
> > task)?
>
> Properties?
>
> <property name="javac.debug" value="off" />
> <javac debug="${debug}" ... />
>
> and you can say
>
> anf -Djavac.debug=true
>
> on the command line to enable debug for all javac tasks at once. But
> you still have to list these attributes yourself.
>
> Stefan
--
Larry V. Streepy, Jr.
Chief Technical Officer and VP of Engineering
Health Language, Inc. -- "We speak the language of healthcare"
970/626-5028 (office) mailto:[EMAIL PROTECTED]
970/626-4425 (fax) http://www.healthlanguage.com