Tuesday, July 19, 2011

Using Tomcat 6 Ant DeployTask

It has been a while since I've setup the Tomcat Ant tasks and thought I'd capture what it took for me to get it working.  I found some great references that made this easy:
The references were using older versions of Tomcat, so there were a few changes in the classpath I had to make.  I also had an issue with a forward slash located in the war attribute in the deploy task example I pulled from Matt Raible's site.

Here is what is working for me:
<path id="tomcat.classpath">
    <pathelement location="${tomcat.home}/bin/tomcat-juli.jar"/>
    <pathelement location="${tomcat.home}/lib/catalina-ant.jar"/>
    <pathelement location="${tomcat.home}/lib/jasper.jar"/>
    <pathelement location="${tomcat.home}/lib/servlet-api.jar"/>
</path>
<taskdef resourcce="org/apache/catalina/ant/catalina.tasks"
        classpathref="tomcat.classpath"/>

<target name="deploy" depends="make-war" if="tomcat.home"
        description="deploy Tomcat to the remote server">
    <deploy url="${manager.url}"
            username="${manager.username}"
            password="${manager.password}"
            path="${webappPath}"
            war="file:${dist.dir}/${webappPath}.war"
            update="true"/>
</target>

1 comment: