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
Change your workspace in Eclipse to \tomcat\webapps Since it is just for your work, this should work fine. Whatever changes you make in Eclipse is in the same directory tomcat looks for applications to deploy
What works for me here is:
context.xml like this:
Then, on Servers tab in Eclipse, on "Modules" tab, I disabled the "Auto Reload" to all the modules being deployed.
Also let the default config to let the auto publishing.
And is using Maven with WTP, don´t forget to leave the contents of src/main/resources in, because Eclipse insists to exclude the contents of this folder of the final build.
Only with all this I got full (VM) classes hot-deploy with resources hot-deploy!!!
In your development environment, just point your Tomcat server to look for JSPs in whatever directory you're developing them in. As soon as you save the file, you'll be able to see the changes then.
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 :You may also have to edit and reload your
webapps/$YourWebApp/web.xml
file and include :I can't remember if both changes are needed but that's how I configured my tomcat-6.0.18 to auto-reload.
In case, you're in hurry:
voila! :)
I've found a simplest way: use of symbolic links: I think this is the fastest way because there is no synchronization at all: tomcat directory and your project directory will be the same directory all the time.
Tomcat will periodically detect the changes and redeploy your application.
There is also a way to debug your application, so I humbly think is a good solution.
I've documented my solution here, for anyone interested.