You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Dennis Gregorovic <de...@arsdigita.com> on 2001/05/21 01:09:13 UTC

How to check j2ee version?

Our build system depends on version 1.2 of j2ee.jar 
being used.  How can I check the version of j2ee.jar 
from Ant?

Thanks
-- Dennis



RE: How to check j2ee version?

Posted by Dennis Gregorovic <de...@arsdigita.com>.
Thanks Robert.  

It was actually the case in my circumstance that we needed 
to make sure that j2ee 1.2 is used and not a *later* version.  
So, I wound up implementing a check for 
javax.servlet.ServletContextEvent, which was introduced in 1.3  

-- Dennis

-----Original Message-----
From: Robert Leftwich [mailto:digital@ix.net.au]
Sent: Sunday, May 20, 2001 7:23 PM
To: ant-user@jakarta.apache.org
Subject: Re: How to check j2ee version?


At 09:09 AM 21-05-01, Dennis Gregorovic wrote:
>Our build system depends on version 1.2 of j2ee.jar
>being used.  How can I check the version of j2ee.jar
>from Ant?

I don't know if there is a class in v1.2 that is not in the previous 
versions but if there is you can use the available tag to set a property 
only if that class is available e.g.

<!-- set the j2ee version -->
<target name="set-j2ee-version">
   <available property="j2ee1.2+" classname="unique.1.2+.j2ee.class" />
</target>

<!-- make sure j2ee version is at least 1.2 -->
<target name="ensure-j2ee" depends="set-j2ee-version" unless="j2ee1.2+">
   <fail message="Can only build if running with J2EE 1.2+"/>
</target>

HTH

Robert



Re: How to check j2ee version?

Posted by Robert Leftwich <di...@ix.net.au>.
At 09:09 AM 21-05-01, Dennis Gregorovic wrote:
>Our build system depends on version 1.2 of j2ee.jar
>being used.  How can I check the version of j2ee.jar
>from Ant?

I don't know if there is a class in v1.2 that is not in the previous 
versions but if there is you can use the available tag to set a property 
only if that class is available e.g.

<!-- set the j2ee version -->
<target name="set-j2ee-version">
   <available property="j2ee1.2+" classname="unique.1.2+.j2ee.class" />
</target>

<!-- make sure j2ee version is at least 1.2 -->
<target name="ensure-j2ee" depends="set-j2ee-version" unless="j2ee1.2+">
   <fail message="Can only build if running with J2EE 1.2+"/>
</target>

HTH

Robert