Writing Ant Targets to Deploy to Tomcat Web Server 4

See Also

When you install the IDE, the installer automatically registers the bundled Tomcat Web Server with the IDE. You can also configure the IDE to deploy web applications to other installations of supported versions of the Tomcat Web Server. These versions need to be registered first. Unsupported versions of the Tomcat Web Server cannot be registered with the IDE. Instead, for these versions you can create Ant targets for starting and stopping the Tomcat Web Server and for the deployment of web applications, JSP pages, and servlets.

To write Ant targets to deploy to Tomcat Web Server 4:

  1. Create a web application project.
  2. In the Files window (Ctrl-2), expand the project node, expand the nbproject node, and double-click the project.properties node. Change the build.web.dir property as follows:
    c:/Program Files/Apache Group/Tomcat 4.1/webapps/MyWebAppProjectName

    Make sure that the path above points to the Tomcat Web server's webapps folder, and replace MyWebAppProjectName with the name of your web application project.

  3. Double-click the build.xml file and add the following targets right above the closing </project> tag: In the targets above, make sure that all the values are correct for your environment and Tomcat Web Server installation. In the Run target, replace MyWebAppProjectName with the name of your web application project.

To integrate the Ant targets with the IDE:

  1. In the Files window, expand the build.xml node, find the startcat4 target node, right-click it, and choose Create Shortcut. You can add a menu item, toolbar button, or keyboard shortcut for each of your new targets.
  2. Right-click the project node, choose Properties, and click Run. Use the Relative URL field to define the client.urlPart, which you specified in the Run target above. For example, type index.jsp (without a slash, because the slash is defined in the Run target).
  3. In the projects window, right-click the project node and choose Build Project. Check that the project is built to the folder that you specified in step 1 above.

To deploy the web application:

  1. Click the shortcut you defined to start the Tomcat Web Server.
  2. Click the shortcut you defined to deploy the web application, JSP page, or servlet.
The JSP page or servlet specified by the client.urlPart property is displayed in the browser that you defined in the Run target.
See Also
About the Tomcat Web Server
Viewing the Tomcat Web Server in the IDE
Customizing the Tomcat Web Server
Customizing the Tomcat Configuration File

Legal Notices