Integrating tomcat and eclipse as a hot-deploy environment

There are two options.

First, Eclipse lets you do this, with a slight change of configuration (see also this detailed post)

  • add Tomcat to the server list
  • make the project “Dynamic web project” (Either through the creation wizard or through the facets section in the settings)
  • add the project to tomcat, and configure its “Deployment assembly”
  • double click tomcat from the list to open the configurations
  • Change “Publishing” to “Never publish automatically” (this means the server won’t get restarted when you hit ctrl+s)
  • start tomcat in debug mode

This will still reflect code changes but won’t restart the server.

Second, I’ve used the FileSync plugin for a long time:

  • configure the plugin to send all classes from the bin director to WEB-INF/classes of your tomcat installation (this is almost the same as configuring the deployment assembly)
  • configure all other resources to go to their respective locations
  • optionally, externalize all absolute paths from the filesync location settings to a single variable, and configure that variable in eclipse (thus you will be able to commit the filesync settings as well, if all members are using eclipse)
  • add Tomcat to the Servers list in eclipse, configure the “Server locations” option to be “Use tomcat installation” (the screen opens when you double-click tomcat from the servers list)
  • start tomcat in debug mode

It works perfectly for me that way. Every non-structural change is reflected immediately, without redeploy.

Update:
You can read more about the methods for hot-deploying here.
I also created a project that easily syncs the workspace with the servlet container.

Leave a Comment