ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: Conditional ANT building
Date Fri, 10 Aug 2001 05:35:09 GMT
On Thu, 9 Aug 2001, T. Master <tmaster@iknowledgeinc.com> wrote:

> I was thinking of something within my init target that would check
> the java.runtime.version.  Then I can enforce within my buildfile
> what jdk version should be used.

Take a look at ant's own build file to see a way to check the JDK
version (the <available> tasks that set properties jdk1.2+ through
jdk1.4+).

Something like

  <target name="check_for_optional_packages">
    <available property="jdk1.2+" classname="java.lang.ThreadLocal" />
  </target>

  <target name="enforce-jdk1.2+" depends="check_for_optional_packages"
          unless="jdk1.2+">
    <fail message="Need JDK 1.2 or higher to build" />
  </target>

should do the trick. Simply make all your targets depend on
enforce-jdk1.2+.

Stefan

Mime
View raw message