blob: 5c3ca7c2639f992eec1c800a3a5294701113585f [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- $Revision$ $Date$ -->
<project default="default"
xmlns:j="jelly:core"
xmlns:u="jelly:util">
<!--======================-->
<!-- Tomcat profiles -->
<!--======================-->
<goal name="tomcat55">
<j:set var="tomcat.branch" value="5"/>
<j:set var="tomcat.version" value="5.5.15"/>
<j:set var="tomcat.prefix" value="apache"/>
<attainGoal name="tomcat.env"/>
</goal>
<goal name="tomcat50">
<j:set var="tomcat.branch" value="5"/>
<j:set var="tomcat.version" value="5.0.30"/>
<j:set var="tomcat.prefix" value="jakarta"/>
<attainGoal name="tomcat.env"/>
</goal>
<goal name="tomcat4">
<j:set var="tomcat.branch" value="4"/>
<j:set var="tomcat.version" value="4.1.31"/>
<j:set var="tomcat.prefix" value="jakarta"/>
<attainGoal name="tomcat.env"/>
</goal>
<goal name="tomcat.env">
<j:set var="targetDir" value="${basedir}/target/"/>
<j:set var="tomcat.home" value="${targetDir}/${tomcat.prefix}-tomcat-${tomcat.version}"/>
<j:set var="openejb.home" value="${targetDir}/openejb-${openejb.version}" />
</goal>
<!--======================-->
<!-- Setup/cleanup -->
<!--======================-->
<goal name="setup:tomcat">
<j:set var="targetDir" value="${basedir}/target/"/>
<j:set var="tomcat.download" value="http://www.ibiblio.org/pub/mirrors/apache/tomcat/tomcat-${tomcat.branch}/v${tomcat.version}/bin/${tomcat.prefix}-tomcat-${tomcat.version}.zip"/>
<j:set var="tomcat.src" value="${maven.repo.local}/tomcat/distributions/${tomcat.prefix}-tomcat-${tomcat.version}.zip"/>
<j:set var="tomcat.dist" value="${maven.repo.local}/tomcat/distributions/${tomcat.prefix}-tomcat-${tomcat.version}.zip"/>
<j:set var="tomcat.home" value="${targetDir}/${tomcat.prefix}-tomcat-${tomcat.version}"/>
<j:set var="openejb.home" value="${targetDir}/openejb-${openejb.version}" />
<!-- Download tomcat if it isn't in the repo -->
<u:file var="fileAsFile" name="${tomcat.dist}"/>
<j:if test="${!(fileAsFile.exists())}">
<mkdir dir="${maven.repo.local}/tomcat/distributions"/>
<get src="${tomcat.download}" dest="${tomcat.dist}"/>
</j:if>
<!-- Unzip if not unzipped -->
<u:file var="fileAsFile" name="${tomcat.home}"/>
<j:if test="${!(fileAsFile.exists())}">
<unjar src="${tomcat.dist}" dest="${targetDir}"/>
<chmod dir="${tomcat.home}/bin" perm="u+x" includes="**/*.sh"/>
</j:if>
</goal>
<goal name="setup:tomcat-src">
<j:set var="targetDir" value="${basedir}/src/"/>
<j:set var="tomcat.download" value="http://www.ibiblio.org/pub/mirrors/apache/tomcat/tomcat-${tomcat.branch}/v${tomcat.version}/src/${tomcat.prefix}-tomcat-${tomcat.version}-src.zip"/>
<j:set var="tomcat.dist" value="${maven.repo.local}/tomcat/distributions/${tomcat.prefix}-tomcat-${tomcat.version}-src.zip"/>
<!-- Download tomcat if it isn't in the repo -->
<u:file var="fileAsFile" name="${tomcat.dist}"/>
<j:if test="${!(fileAsFile.exists())}">
<mkdir dir="${maven.repo.local}/tomcat/distributions"/>
<get src="${tomcat.download}" dest="${tomcat.dist}"/>
</j:if>
<unjar src="${tomcat.dist}" dest="${basedir}"/>
</goal>
<goal name="delete:tomcat">
<delete dir="${tomcat.home}"/>
</goal>
<!--======================-->
<!-- Start/stop -->
<!--======================-->
<goal name="start:tomcat">
<j:choose>
<j:when test="${systemScope['os.name'].startsWith('Windows')}">
<exec executable="${tomcat.home}/bin/startup.bat" os="Windows NT,Windows 2000,Windows XP">
<env key="CATALINA_HOME" value="${tomcat.home}"/>
</exec>
</j:when>
<j:otherwise>
<exec executable="${tomcat.home}/bin/startup.sh"/>
</j:otherwise>
</j:choose>
</goal>
<goal name="start:tomcat-debug">
<j:choose>
<j:when test="${systemScope['os.name'].startsWith('Windows')}">
<exec executable="${tomcat.home}/bin/startup.bat" os="Windows NT,Windows 2000,Windows XP">
<env key="JAVA_OPTS" value="-Dopenejb.home=${openejb.home} -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"/>
<env key="CATALINA_HOME" value="${tomcat.home}"/>
</exec>
</j:when>
<j:otherwise>
<exec executable="${tomcat.home}/bin/startup.sh">
<env key="JAVA_OPTS" value="-Dopenejb.home=${openejb.home} -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"/>
</exec>
</j:otherwise>
</j:choose>
</goal>
<goal name="stop:tomcat">
<j:choose>
<j:when test="${systemScope['os.name'].startsWith('Windows')}">
<exec executable="${tomcat.home}/bin/shutdown.bat"
os="Windows NT,Windows 2000,Windows XP">
<env key="CATALINA_HOME" value="${tomcat.home}"/>
</exec>
</j:when>
<j:otherwise>
<exec executable="${tomcat.home}/bin/shutdown.sh" />
</j:otherwise>
</j:choose>
</goal>
<!--======================-->
<!-- Deploy -->
<!--======================-->
<goal name="setup:itests-webapp">
<!-- Unzip webapp and set openejb.home -->
<mkdir dir="${tomcat.home}/webapps/itests"/>
<unjar src="${basedir}/target/openejb-itests-webapp-${openejb.version}.war" dest="${tomcat.home}/webapps/itests"/>
</goal>
<!--======================-->
<!-- Testing profiles -->
<!--======================-->
<goal name="test:tomcat-webapp">
<attainGoal name="setup:tomcat"/>
<attainGoal name="setup:itests-webapp"/>
<!--<attainGoal name="start:tomcat"/>-->
<java jar="target/openejb-itests-webappclient-test.jar" fork="yes">
<sysproperty key="openejb.home" value="target/openejb-${openejb.version}"/>
<sysproperty key="tomcat.home" value="${tomcat.home}"/>
<sysproperty key="remote.serlvet.url" value="http://127.0.0.1:8080/itests/remote"/>
<arg value="tomcat"/>
<!--<jvmarg value="-Xdebug"/>-->
<!--<jvmarg value="-Xnoagent"/>-->
<!--<jvmarg value="-Djava.compiler=NONE"/>-->
<!--<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"/>-->
</java>
<!--<attainGoal name="stop:tomcat"/>-->
</goal>
<goal name="itest:all">
<attainGoal name="tomcat4"/>
<attainGoal name="test:tomcat-webapp"/>
<attainGoal name="tomcat50"/>
<attainGoal name="test:tomcat-webapp"/>
<j:if test="${systemScope['java.version'].startsWith('1.5')}">
<attainGoal name="tomcat55"/>
<attainGoal name="test:tomcat-webapp"/>
</j:if>
</goal>
<goal name="itest">
<attainGoal name="tomcat55"/>
<attainGoal name="test:tomcat-webapp"/>
</goal>
<!-- Try this if things get rough
java -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005 -jar target/openejb-1.0-SNAPSHOT/lib/openejb-core-1.0-SNAPSHOT.jar start
-->
</project>