--- Steffen Euch <[EMAIL PROTECTED]> wrote:
> Is it possible to set the attributes (classpath, debug, deprecation, 
> failonerror, ...) for several <javac> tasks all at once?

Well, anything's possible :)

At present, there isn't an Ant-specific mechanism for doing this, but
there are some proposals to make it available for Ant2. In the meantime,
the best I could come up with for you is using the XML include-type
mechanism (as described in the Ant FAQ), but doing it that way doesn't
allow the use of any nested elements -- it barks if your "include" file
has the opening "<javac", the list of attrs, and an ending ">" but doesn't
include the end tag :(  So you end up needing to do an <antcall> to the
"templated" target, in order to pass the files you want to include/exclude
and any adjusted classpath you might need. (I'm assuming you have your
multiple <javac> tasks because these types of things vary, yes?)

Anyway, this is what I was able to come up with:
<?xml version="1.0"?>

<!DOCTYPE project [<!ENTITY javac SYSTEM "file:./javac.xml">]>

<project name="compile" default="compile" basedir=".">

  <target name="doCompile">
    &javac;
  </target>

  <target name="compile">
    <antcall target="doCompile">
      <param name="infiles" value="Foo.java"/>
    </antcall>
  </target>

</project>

With javac.xml containing:
    <javac
      debug="${debug}"
      depend="${depend}"
      deprecation="${deprecation}"
      optimize="${optimize}"
      failonerror="${proceed}"
      verbose="${verbose}"
      srcdir="${javasrc.dir}"
      destdir="${out.dir}"
      includes="${infiles}"
      excludes="${exfiles}"
      classpath="${classpath}"/>

(It could also contain the settings for the properties -- I just didn't
bother to show that.)

Diane

=====
([EMAIL PROTECTED])



__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

Reply via email to