| At line 3 changed 1 line. |
| 1. First, I defined a tomcat.classpath for the catalina-ant.jar file. Putting in in $ANT_HOME/lib did not work - and this way seemed cleaner. So in properties.xml, I added: |
| 1. First, I defined a tomcat.classpath for the catalina-ant.jar file. Putting in in $ANT_HOME/lib did not work - and this way seemed cleaner. So in __properties.xml__, I added: |
| At line 5 changed 3 lines. |
| <path id="tomcat.classpath"> |
| <fileset dir="${tomcat.home}/server/lib" includes="*.jar" /> |
| </path> |
| <!-- For Tomcat Tasks --> |
| <path id="tomcat.classpath"> |
| <fileset dir="${tomcat.home}/server/lib" |
| includes="catalina-ant.jar" /> |
| </path> |
| At line 11 added 47 lines. |
| 2. Then in __build.xml__, I define the tasks in the "define-tasks" target: |
| {{{ |
| <!-- Tomcat Tasks --> |
| <taskdef name="install" |
| classname="org.apache.catalina.ant.InstallTask" |
| classpathref="tomcat.classpath" /> |
| <taskdef name="list" |
| classname="org.apache.catalina.ant.ListTask" |
| classpathref="tomcat.classpath" /> |
| <taskdef name="reload" |
| classname="org.apache.catalina.ant.ReloadTask" |
| classpathref="tomcat.classpath" /> |
| <taskdef name="remove" |
| classname="org.apache.catalina.ant.RemoveTask" |
| classpathref="tomcat.classpath" /> |
| }}} |
| 3. Then I created targets for each one of these tasks: |
| {{{ |
| <!-- =================================================================== --> |
| <!-- install, list, reload and remove are all Tomcat deployment targets. --> |
| <!-- =================================================================== --> |
| <target name="install" depends="package-web" |
| description="Install application to servlet container"> |
| <install url="${tomcat.manager.url}" username="${tomcat.username}" |
| password="${tomcat.password}" path="/${webapp.name}" |
| war="file://${webapp.dist}/${webapp.war}"/> |
| </target> |
|
| <target name="list" depends="init" |
| description="List installed applications on servlet container"> |
| <list url="${tomcat.manager.url}" username="${tomcat.username}" |
| password="${tomcat.password}" /> |
| </target> |
|
| <target name="refresh" depends="package-web" |
| description="Reload application on servlet container"> |
| <reload url="${tomcat.manager.url}" username="${tomcat.username}" |
| password="${tomcat.password}" path="/${webapp.name}"/> |
| </target> |
|
| <target name="remove" depends="init" |
| description="Remove application on servlet container"> |
| <remove url="${tomcat.manager.url}" username="${tomcat.username}" |
| password="${tomcat.password}" path="/${webapp.name}"/> |
| </target> |
| }}} |
| __NOTE:__ I used "refresh" as a target name since I already have a "reload" task that stops tomcat, undeploys, cleans and redeploys. |