[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ant-user
Subject:    Re: Is there an ant task (inbuilt in ant core) to verify the version of a jre?
From:       "Peter Reilly" <peter.kitt.reilly () gmail ! com>
Date:       2007-10-25 16:43:52
Message-ID: dffc72020710250943u238a8d88k6805157e30717f72 () mail ! gmail ! com
[Download RAW message or body]

Use the fail task:
    <fail message="Not running ant with JDK 1.4 - this will
result in differing class versions">
      <condition>
        <not>
          <equals arg1="${ant.java.version}" arg2="1.4" />
        </not>
      </condition>
    </fail>

Be aware however taht using the target and source attributes for
the javac task will generate correct class versions.
Peter


On 10/25/07, Vijay Aravamudhan <avijayr@gmail.com> wrote:
> hi,
> On many of my projects, we need to compile against the 1.4 JDK.
> Depending on what any individual developer might have installed, we run
> into issues with JDK versions ranging from 1.4.x, 1.5.x and 1.6.
> Does anyone know if there is a task in ant which can be used to verify
> the version of the JDK and possibly fail the build if the version does
> not match what the project needs? (For eg: The limitation could be that
> the app server being used does not support more than JDK 1.4)
>
> To get around this currently, I have the following lines at the top of
> the build file:
>     <!-- allows non-standard tasks <foreach> and <if> -->
>     <taskdef resource="net/sf/antcontrib/antlib.xml"
> classpath="lib/compile/ant-contrib.jar" />
>
>     <!-- verify that the current java version is correct -->
>     <if>
>         <not>
>             <equals arg1="${ant.java.version}" arg2="1.4" />
>         </not>
>         <then>
>             <fail message="Not running ant with JDK 1.4 - this will
> result in differing class versions" />
>         </then>
>     </if>
>
> But, as you can see, this creates a dependency on the ant-contrib jar.
> What I would like to achieve is the same - but without having to include
> the ant-contrib jar.
>
> thanks,
> Vijay
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic