ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gordon Tyler" <gordon.ty...@sitraka.com>
Subject Re: setting a specific compiler
Date Fri, 26 Apr 2002 15:14:24 GMT
Hi Jamie,

I've gone through the same sort of hassle recently and this is the solution
that I came up with based on a suggestion from Stefan Bodewig:

Our main build environment is JDK 1.4 but there are parts of the system that
must be compiled with JDK 1.3. So Ant is executed using JDK 1.4 and uses the
cross compiling options when compiling the 1.3 classes. This is what some of
our build file looks like:

  <target name="compile-java-1.3">
    <javac debug="yes"
        deprecation="yes"
        includeantruntime="false"
        includejavaruntime="false"
        target="1.2"
        source="1.3"
        extdirs="${java13.home}/jre/lib/ext"
        destdir="${build}"
        srcdir="${src}">
      <bootclasspath>
        <pathelement location="${java13.home}/jre/lib/rt.jar"/>
      </bootclasspath>
      <classpath refid="alto.classpath"/>
      <include name="${alto.package}/agent/**/*.java"/>
      <include name="${alto.package}/common/**/*.java"/>
      <exclude
name="${alto.package}/common/communication/generator/*.java"/>
      <exclude name="${alto.test.dir}/*.java"/>
    </javac>
  </target>

  <target name="compile-java-1.4">
    <javac debug="yes"
        deprecation="yes"
        destdir="${build}"
        srcdir="${src}"
        target="1.4"
        source="1.4">
      <classpath refid="alto.classpath"/>
      <include name="${alto.package}/client/**/*.java"/>
      <include name="${alto.package}/commonui/**/*.java"/>
      <include name="${alto.package}/nexus/**/*.java"/>
      <include name="${alto.package}/workstation/**/*.java"/>
      <exclude name="${alto.test.dir}/*.java"/>
    </javac>
  </target>

Where java13.home is a property defined to point to the JDK 1.3 directory.

Of course we have to make sure that that none of the 1.3 compiled classes
refer to 1.4 compiled classes since it dies with the incorrect class version
error.

Ciao,
Gordon


--
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