Appendix D. Eclipse Tomcat and the Tomcat Deployer [Contributed by Patricia Karsten]

This solution was contributed by Patricia Karsten. The actual text of the email has been adapted for instructions.

These instructions involve the following components:

D.1. About the Tomcat Deployer

According to the manual that comes with the tarball, the Tomcat 5 Deployer "allows deploying and undeploying web applications to the Tomcat server, either statically (the application is setup before the server is started), or dynamically (in conjunction with the Tomcat Manager web application or manipulating already deployed applications)."

The Tomcat deployer is particularly useful if you use an Integrated Development Environment (IDE) and want to test your web applications on a running Tomcat, without actually deploying the web application to Tomcat.

D.2. Integrating the Tomcat Deployer, Eclipse and Tomcat

  1. Download the Tomcat 5 Deployer tarball and untar it.

  2. Copy catalina-deployer.war from jakarta-tomcat-5.0.25-deployer/lib into the eclipse ant plugin folder, eclipse/plugins/org.apache.ant_1.5.3

  3. Copy the following lines from the deployer's build.xml ( jakarta-tomcat-5.0.25-deployer/build.xml ) into Eclipse's project build.xml file:

     <target name="deploy" description="Deploy web application">
        <deploy url="${url}" username="${username}" password="${password}"
                path="${path}" war="${webapp.path}.war" update="true" />
      </target>
    
  4. Make the necessary changes to the variable values in the deployer's build.xml file to reflect your own environment:

     <target name="deploy" description="Deploy web application">
        <deploy url="${manager.url}" username="${manager.username}"
                         password="${manager.password}"
                path="${app.path}" war="${dist.home}/${app.name}-${app.version}.war" update="true" />
     </target>
    
  5. Run ant with targets all (clean compile), dist (create .war-file), deploy (copy contents of build-folder to tomcat), in this order. The dist-target might not be necessary because the deployer seems to use the contents of the build folder as its input, not the .war file. On the other hand, I would not know what to provide as correct value for war="..." without getting error messages.

If you have any difficulties with this process, please post your question to the Tomcat-Users mailing list.