ant-deploy.xml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project default="-deploy-ant" basedir=".">
  3. <target name="-init" if="deploy.ant.enabled">
  4. <property file="${deploy.ant.properties.file}"/>
  5. <tempfile property="temp.module.folder" prefix="tomcat" destdir="${java.io.tmpdir}"/>
  6. <unwar src="${deploy.ant.archive}" dest="${temp.module.folder}">
  7. <patternset includes="META-INF/context.xml"/>
  8. </unwar>
  9. <xmlproperty file="${temp.module.folder}/META-INF/context.xml"/>
  10. <delete dir="${temp.module.folder}"/>
  11. </target>
  12. <target name="-check-credentials" if="deploy.ant.enabled" depends="-init">
  13. <fail message="Tomcat password has to be passed as tomcat.password property.">
  14. <condition>
  15. <not>
  16. <isset property="tomcat.password"/>
  17. </not>
  18. </condition>
  19. </fail>
  20. </target>
  21. <target name="-deploy-ant" if="deploy.ant.enabled" depends="-init,-check-credentials">
  22. <echo message="Deploying ${deploy.ant.archive} to ${Context(path)}"/>
  23. <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"
  24. classpath="${tomcat.home}/server/lib/catalina-ant.jar"/>
  25. <deploy url="${tomcat.url}/manager" username="${tomcat.username}"
  26. password="${tomcat.password}" path="${Context(path)}"
  27. war="${deploy.ant.archive}"/>
  28. <property name="deploy.ant.client.url" value="${tomcat.url}${Context(path)}"/>
  29. </target>
  30. <target name="-undeploy-ant" if="deploy.ant.enabled" depends="-init,-check-credentials">
  31. <echo message="Undeploying ${Context(path)}"/>
  32. <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"
  33. classpath="${tomcat.home}/server/lib/catalina-ant.jar"/>
  34. <undeploy url="${tomcat.url}/manager" username="${tomcat.username}"
  35. password="${tomcat.password}" path="${Context(path)}"/>
  36. </target>
  37. </project>