Way 1: Look at properties file: org/apache/catalina/util/ServerInfo.properties
Way 2:
Cehck for the existence of a class that you know exists in tomcat5 but not tomcat 4.
Use one of the ways above to set a property to let you know the tomcat version. I'm not sure which way would be easier at the moment.
-Tim
Matt Raible wrote:
Is it possible to detect the version of Tomcat that the user has in Ant? I have the following Ant task:
<!-- =================================================================== -->
<!-- Setup Tomcat 4.1 -->
<!-- =================================================================== -->
<target name="setup-tomcat" if="tomcat.home"
description="copies jdbc driver and context.xml to tomcat">
<echo level="info">Copying database JDBC Driver to ${tomcat.home}/common/lib</echo>
<copy todir="${tomcat.home}/common/lib" file="${database.jar}"/>
<echo level="info">Copying ${webapp.name}.xml to ${tomcat.home}/webapps</echo>
<copy tofile="${tomcat.home}/webapps/${webapp.name}.xml"
file="metadata/web/tomcat-context.xml" />
</target>
Copying the tomcat-context.xml file to $CATALINA_HOME/webapps/${webapp.name}.xml will only work on Tomcat 4.1.x. For Tomcat 5.0.x, it needs to go in $CATALINA_HOME/conf/Catalina/localhost/. I'd like to auto-detect Tomcat 5 and deploy to the appropriate place. Is there a class I can check for or something?
Thanks,
Matt
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
