| <!-- | |
| Copyright 2004 The Apache Software Foundation. | |
| Licensed 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. | |
| --> | |
| <project default="deployPlutoToTomcat" | |
| xmlns:j="jelly:core" | |
| xmlns:maven="jelly:maven" | |
| xmlns:ant="jelly:ant"> | |
| <!-- the war goal should always create pluto.war | |
| with no version numbers. Why?--> | |
| <preGoal name="war:init"> | |
| <j:set var="maven.war.final.name" value="pluto.war"/> | |
| </preGoal> | |
| <preGoal name="war:install"> | |
| <attainGoal name="jar:install"/> | |
| </preGoal> | |
| <preGoal name="tomcat:deploy"> | |
| <j:set var="maven.war.final.name" value="pluto.war"/> | |
| </preGoal> | |
| <goal name="tomcat:init"> | |
| <j:set var="vers" value="${maven.tomcat.version.major}"/> | |
| <j:if test="${vers==null}"> | |
| <ant:available property="maven.tomcat.version.major" | |
| value="5" | |
| type="file" | |
| file="${maven.tomcat.home}/conf/Catalina/admin.xml"/> | |
| </j:if> | |
| <j:set var="vers" value="${maven.tomcat.version.major}"/> | |
| <j:if test="${vers==null}"> | |
| <ant:available property="maven.tomcat.version.major" | |
| value="5" | |
| type="file" | |
| file="${maven.tomcat.home}/webapps/admin.xml"/> | |
| </j:if> | |
| <j:set var="depl" value="${maven.tomcat.deploy}"/> | |
| <j:if test="${depl != 'exploded'}"> | |
| <j:set var="maven.tomcat.deploy" value="war"/> | |
| </j:if> | |
| <echo>Deploying to Tomcat: | |
| Location: ${maven.tomcat.home} | |
| Major Version: ${maven.tomcat.version.major} | |
| Hosts: ${maven.tomcat.host} | |
| Context Config: ${maven.tomcat.context.config} | |
| Deploy Type: ${maven.tomcat.deploy} | |
| </echo> | |
| </goal> | |
| <goal name="tomcat:deploy"> | |
| <attainGoal name="tomcat:init"/> | |
| <!-- ===================== --> | |
| <!-- Deploy Dependencies --> | |
| <!-- ===================== --> | |
| <j:forEach var="lib" items="${pom.artifacts}"> | |
| <j:set var="dep" value="${lib.dependency}"/> | |
| <j:if test="${dep.getProperty('tomcat.common')=='true'}"> | |
| <j:if test="${dep.type =='jar'}"> | |
| <j:if test="${dep.getProperty('tomcat.common.endorsed')!='true'}"> | |
| <ant:copy todir="${maven.tomcat.home}/common/lib" file="${lib.path}"/> | |
| </j:if> | |
| <j:if test="${dep.getProperty('tomcat.common.endorsed')=='true'}"> | |
| <ant:copy todir="${maven.tomcat.home}/common/endorsed" file="${lib.path}"/> | |
| </j:if> | |
| </j:if> | |
| <j:if test="${dep.type !='jar'}"> | |
| <ant:copy todir="${maven.tomcat.home}/common/classes" file="${lib.path}"/> | |
| </j:if> | |
| </j:if> | |
| <j:if test="${dep.getProperty('tomcat.shared')=='true'}"> | |
| <j:if test="${dep.type =='jar'}"> | |
| <ant:copy todir="${maven.tomcat.home}/shared/lib" file="${lib.path}"/> | |
| </j:if> | |
| <j:if test="${dep.type !='jar'}"> | |
| <ant:copy todir="${maven.tomcat.home}/shared/classes" file="${lib.path}"/> | |
| </j:if> | |
| </j:if> | |
| </j:forEach> | |
| <!-- ===================== --> | |
| <!-- Deploy War --> | |
| <!-- ===================== --> | |
| <j:set var="depType" value="${maven.tomcat.deploy}"/> | |
| <j:if test="${depType=='exploded'}"> | |
| <unwar src="target/${maven.war.final.name}" dest="${maven.tomcat.home}/webapps/pluto"/> | |
| </j:if> | |
| <j:if test="${depType=='war'}"> | |
| <copy file="target/${maven.war.final.name}" | |
| todir="${maven.tomcat.home}/webapps"/> | |
| </j:if> | |
| <!-- ===================== --> | |
| <!-- Deploy Context Config --> | |
| <!-- ===================== --> | |
| <j:set var="version" value="${maven.tomcat.version.major}"/> | |
| <!-- If we are in Tomcat4.x--> | |
| <j:if test="${version==4}"> | |
| <copy file="${maven.tomcat.context.config}" | |
| todir="${maven.tomcat.home}/webapps"/> | |
| </j:if> | |
| <!-- If we are in Tomcat5.x--> | |
| <j:if test="${version==5}"> | |
| <copy file="${maven.tomcat.context.config}" | |
| todir="${maven.tomcat.home}/conf/Catalina/${maven.tomcat.host}"/> | |
| </j:if> | |
| </goal> | |
| </project> |