In Ant:

(How i use it: put project.correct.java.version=[Major].[Minor])

   <!-- ==================================================
       Check for correct java version                     
       ================================================== -->
  <preGoal name="java:compile">
        <echo message="Current Java Version is:
${java.specification.version} and should be:
${project.correct.java.version}"/>
        
        <!-- set property if the version is correct -->
        <condition property="java.version.is.correct">
                <!-- Property explanation: -->
            <!-- Less detailled version = java.specification.version (1.2)
-->
                <!-- More Detailled version = java.version (1.2.1_02) -->
        
            <equals arg1="${project.correct.java.version}"
                    arg2="${java.specification.version}" />
    </condition>
        <fail unless="java.version.is.correct" message="Incorrect java
version" />  
  </preGoal>   

There are always several ways for the same ;-> 
  

-----Urspr�ngliche Nachricht-----
Von: Brett Porter [mailto:[EMAIL PROTECTED] 
Gesendet: Freitag, 16. Juli 2004 02:51
An: Maven Users List
Betreff: Re: Checking Java Version

In Jelly:

<j:set var="var" value="${systemScope.getProperty('java.version')}"/>
<j:if test="${var != '1.3.1_09'}">
  <fail>Must use JDK 1.3.1_09!</fail>
</j:if>

On Thu, 15 Jul 2004 15:08:46 +0200, Henri Tremblay
<[EMAIL PROTECTED]> wrote:
> I'm not really good with jelly but as soon as you can access
> 
> System.getProperty("...")
> 
> There are 2 interesting properties:
> java.version=1.4.2_01
> java.specification.version=1.4
> 
> You should have what you need.
> 
> Cheers,
> Henri
> 
> >From: "Raphael Philipe Mendes da Silva" <[EMAIL PROTECTED]>
> >Reply-To: "Maven Users List" <[EMAIL PROTECTED]>
> >To: "Maven Users List (E-mail)" <[EMAIL PROTECTED]>
> >Subject: Checking Java Version
> >Date: Thu, 15 Jul 2004 09:24:38 -0300
> 
> 
> >
> >    Hi,
> >    In ou company we have some restrictions with the version of the 
> >JVM. We need to use the version 1.3.1_09 because of our clients machines.
> >    Recently a developer used some methods only presents since the 
> >version
> >1.4 in a component, and our daily build failed, because the machine 
> >that is used to daily builds have the jvm 1.3 .We need some way to 
> >detect the jvm version to prevent these errors when the developers 
> >are testing his components localy, in his machines.
> >    There are some way to detect the jvm version in a jelly script 
> >using some ant task or maven tag???
> >
> >
> >Regards
> >
> >Raphael Philipe Mendes da Silva
> >DSB - Diretoria de Solu��es em Billing CPqD Telecom & IT Solutions
> >Tel.: +55 19 3705-6957
> >www.cpqd.com.br
> >[EMAIL PROTECTED]
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
> 
> _________________________________________________________________
> Add photos to your e-mail with MSN 8. Get 2 months FREE*.
> http://join.msn.com/?page=features/featuredemail
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to