当前位置: 代码迷 >> J2SE >> 请高手解决ant部署tomcat有关问题
  详细解决方案

请高手解决ant部署tomcat有关问题

热度:222   发布时间:2016-04-24 13:29:13.0
请高手解决ant部署tomcat问题

题 因为需要持续的构建struts2,采用ANT部署WAR到TOMCAT 5.5.23
但每次UNDEPLOY后,app.WAR没有了,app文件夹依然存在于tomcat的webapps下

提示
[Copy to clipboard] [ - ]
CODE:
undeploy:
[undeploy] OK - Undeployed application at context path /struts
deploy:
  [deploy] FAIL - Application already exists at path /struts

build.xm
[Copy to clipboard] [ - ]
CODE:
<?xml version="1.0"?>

<project name="struts" default="init" basedir=".">

  <!-- Configure the custom Ant tasks for the Manager application -->
  <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask" />
  <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask" />
  <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask" />

  <!-- Configure properties to access the Manager application -->
  <property name="url" value="http://127.0.0.1:8888/manager" />
  <property name="username" value="admin" />
  <property name="password" value="88888888" />
  <property name="tomcat_webapps" value="D:\apache-tomcat-5.5.23\webapps" />
   
  <property name="project" value="struts" />

  <target name="init">
  <record name="verbose.log" action="start" loglevel="verbose" />
  <record name="debug.log" action="start" loglevel="debug" />
  <path id="path.lib">
  <fileset dir="lib" includes="**/*.jar" />
  <fileset dir="libdev" includes="**/*.jar" />
  </path>
  </target>

  <target name="war" depends="init">
  <delete dir="build" />  
  <mkdir dir="build/classes" />
  <javac destdir="build/classes" srcdir="src" classpathref="path.lib" />
  <copy todir="build/classes">
  <fileset dir="src">
  <include name="**/*.xml" />
  </fileset>
  </copy>

  <war destfile="build/struts.war" webxml="etc/web.xml">
  <fileset dir="page" />
  <webinf dir="etc" />
  <lib dir="lib" />
  <classes dir="build/classes" />
  </war>

  <!--
  <copy 
  todir="D:\apache-tomcat-5.5.23\webapps" 
  file="build/struts.war"
  overwrite="true"
  />
  -->
  </target>

  <target name="undeploy">
  <undeploy url="${url}" username="${username}" password="${password}" path="/${project}" />
  </target>
  相关解决方案