gump-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: 1.1 still hanging about??
Date Tue, 19 Oct 2004 08:03:20 GMT
On Tue, 19 Oct 2004, Niclas Hedhman <niclas@hedhman.org> wrote:

> Anyone has any clue what this is?

Yes.

If you use <javac> without a target attribute, Ant won't use the
-target command line switch.  Sun changed the default of -target 1.3
to -target 1.4 with JDK 1.4 so many builds switched to specifying
target="1.1" to create classes that can be used on older JDKs.

Now the same happens to the source attribute.  If you leave it off,
Ant won't pass -source to the compiler.  In JDK 1.4 the default for
-source has been 1.3 which means -target 1.1 is fine (and thus nobody
specified the source attribute).  With JDK 1.5 they changed the
default to 1.4 and then a 

<javac target="1.1"/>

will use -target 1.1 -source 1.4 implicitly on JDK 1.5 which is an
incompatible combination of argument.

To make things worse, -target 1.1 -source 1.3 doesn't work for JDK 1.5
either IIRC and at the same time -source doesn't allow 1.2 or 1.1 in
JDK 1.4 so you need to do something silly like the Ant build file

  <target name="javac.preset" depends="javac.preset.1.5+,javac.preset.1.5-"/>
  <target name="javac.preset.1.5+" depends="check_for_optional_packages"
          if="jdk1.5+">
    <presetdef name="javac.preset">
      <javac source="${javac.source}"/>
    </presetdef>
  </target>
  <target name="javac.preset.1.5-" depends="check_for_optional_packages"
          unless="jdk1.5+">
    <presetdef name="javac.preset">
      <javac/>
    </presetdef>
  </target>

in order to support all JDKs properly.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@gump.apache.org
For additional commands, e-mail: general-help@gump.apache.org


Mime
View raw message