I would like to setup eclipse and tomcat in an integrated fashion such that changes to my JSPs and servlets(if possible) are reflected immedietely without requiring a deployment.
Ok, this is one of those questions that has plenty of answers all across the internet but they all seem different. (use Sysdeo plugin, use JBOss plugin, do stuff with an outdated Eclipse, use MyEclipse instead etc.) and I couldn't find 1 definitive resource to refer to. So for my benefit, what is the simplest and most recommended procedure to set this up ?
This assumes I have eclipse and tomcat running independently. I actually have managed to integrate them in a non-hot deploy fashion using instructions here : http://www.ibm.com/developerworks/opensource/library/os-eclipse-tomcat/index.html
Eclipse version Version: 3.4.2 (Ganymede) Tomcat v6.0.20
However, Tomcat also supports a variety of hot deployment options, allowing users to roll out new applications, or even update existing ones, while the server is still running.
Make sure your application is deployed and running. Open the Console tab in Eclipse. Make a change in your application. After a couple of seconds you should see your change getting automatically built and deployed to Tomcat.
If you need to deploy and undeploy your webapp without needing to restart the Tomcat JVM in order for the deployment and undeployment to take effect, you want "Hot Deployment." In this section, we focus on local filesystem hot deployment, where everything happens on one machine, as opposed to remote hot deployment, ...
There are two options.
First, Eclipse lets you do this, with a slight change of configuration (see also this detailed post)
This will still reflect code changes but won't restart the server.
Second, I've used the FileSync plugin for a long time:
WEB-INF/classes
of your tomcat installation (this is almost the same as configuring the deployment assembly)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.
Simply let eclipse write the class files directly to the $TOMCAT/webapps/MyWebApp/WEB_INF/classes directory. Then, configure apache-tomcat to check if the class files have been updated, and reload them if they have.
To configure tomcat to auto-reload a class when it changes, you need to
edit $TOMCAT/conf/context.xml
and set :
<Context reloadable="true">
You may also have to edit and reload your webapps/$YourWebApp/web.xml
file and include :
<web-app reloadable="true">
I can't remember if both changes are needed but that's how I configured my tomcat-6.0.18 to auto-reload.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With