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
Are you open to using Jetty for development purposes?
If so, it's pretty simple to use with Maven - just run
mvn jetty:run
In servers view , create a new server , don't add any resource (project) to the server yet. Double click on the server in servers location. Choose "Use tomcat installation". Modify "Deploy path" to the tomcat deploy directory (Ex: c:\server\Tomcat 7.0.14\webapps). Extend "Publishing section". Check "Automatically publish after a build event". Save and close. From the eclipse menu check "Project -> Build automatically". From the servers view , right click on your server , "Add and remove" , publish you project.
Simplest, quickest: set Eclipse up to generate a WAR file when you build; as a post-build step, copy that WAR file into your tomcat webapps directory. Tomcat will recognize the change and refresh the site with no deployment necessary. Note that this isn't perfect; users using that webapp may have a less than optimal experience, as Tomcat restarts the webapp "under" them; but this does fit your request.
can we use the below option? Double click on Server in eclipse -> Server Locations -> Use tomcat installation. It takes control of the tomcat installation. You dont need to restart the server for changes in java classes.
This may not be the best way, but it works for me.
I use an rsync command to sync up changes from my jsp project to the $contextPath.
Use remote debugging in Eclipse for Tomcat which will allow limited hot-swapping of code. If you change static fields or add methods, you will need to export the jar and restart the context.
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.