views:

122

answers:

1

We currently use MyEclipse with its built-in Maven4MyEclipse integration and its built-in J2EE server support, but want to convert over to regular eclipse (Helios specifically) to be able to use its 64-bit install on windows. (MyEclipse does not yet support 64-bit on Windows.)

So far I've got a working prototype of Helios eclipse using m2eclipse with the WTP plugin deploying our large web application to tomcat. Deployment is a little processor intensive, but it works and the app starts up.

What is critically different here is how the dependent projects are deployed. In our MyEclipse environment all of the dependent projects were deployed exploded out into the WEB-INF/classes folder, and so while the server was running, a change to a java class in the IDE would copy only the affected file(s) to the server's WEB-INF/classes and hot-swap the class into the JVM and... boom - live change to the server. GREAT for debugging.

In my helios conversion, however, all dependent projects get JARed and put into WEB-INF/lib. This has the advantage of actually looking like what our real maven-built production image looks like, but the development environment is severely disadvantaged by this in that the hot-swapping capability seems to be totally lost. Here, if I change a java class in a dependent project, m2eclipse will re-package the JAR, see that the deployed web application is out of sync, and republish the whole application. Not only is this a problem in that the entire web application has to cycle (something ours frankly doesn't do well given its size and huge initialization time), it is also a nasty delay in eclipse doing its republish. (For our application this takes about a minute or two.)

So my question is this: is there a way to get changes inside dependent projects to hot-swap to the running JVM and replace deployed files without this nasty republish penalty? I am assuming that this means deploying those class files to the WEB-INF/classes but don't know for sure that is (a) possible or (b) really necessary as part of this solution.

What are others doing to solve this? Is it solvable?

Thanks in advance!

A: 

I think that you are looking for the solution described in Re: WTP Tomcat hot deploy with m2eclipse:

If you enable the "Serve Modules Without Publishing" option, then a special jar is added to the Tomcat server which allows the Tomcat support in WTP to control the "classpath" of the web application. Also, utility projects are not assembled in to jars. Instead, the Java output folder(s) of the utility projects are included in the "classpath" of the web application, effectively serving the class files directly. If you disable the auto-loading for the context, and run in debug mode, changes you make to classes can be hot-code-replaced so the context doesn't have to reload. I believe this will accomplish what you are looking for.

To do so:

  • Go to the Server view
  • Double-click your Tomcat server to open the server settings
  • In Server Options, select the Serve modules without publishing option
  • In Publishing, select the Never publish automatically option
Pascal Thivent
AWESOME! That's exactly what I was looking for. (All of my searches somehow missed this, tho in my defense the eclipse forums seemed to be offline from this last Sunday until very recently, so all my search hits in that area were inaccessible!)Thanks for the very detailed, accurate and quick reply. This worked beautifully!
Scott
@Scott: You're welcome. Glad it was helpful.
Pascal Thivent
@Scott: BTW, feel free to accept this answer if you think it was helpful (the green tick below the vote counter on the left).
Pascal Thivent