views:

409

answers:

2

I try to work with M2Eclipse, WTP and a Tomcat 5.5 server configuration. Publication of classes + web resources in wtp.deploy directory seams very time consuming if your webapp contains many files. Furthermore publishing operation can be prone to error as I have many maven modules as dependencies. I try to find a biaised-but-faster way to use WTP.

With Java sources in

  • src/main/java
  • src/main/resources

with default maven output directory

  • target/classes

And web resources in

  • src/main/webapp

I want to make WTP work with a Tomcat server this way :

  1. M2Eclipse is responsible of the build (nothing to do)
  2. No publication phase :
    • WTP points to maven classes build output (don't know how to do this ?)
    • WTP points directly to the web resources (possible tweaking the docbase)
  3. WTP take into account any change I do either on classes or web resources (not sure it's possible for classes without restarting tomcat ?)

Is it possible or should I move to maven jetty plugin ? Any help is apreciated :)

A: 

I don't think it is possible to make WTP work that way. The way WTP work with Tomcat is it creates a staging directory/project in workspace that it synchronizes with your project (I believe it is incremental). So, the WTP does all the copying files around and tracking modified resources and classes.

If you want to avoid this, there isn't much sense to use WTP and you can just stick to Jetty runner.

Eugene Kuleshov
A: 

What you want is probably the "Serve modules without publishing" setting to let allow tomcat straight access to the eclipse-generated resources.

In the servers view, double click the server name, e.g. "Tomcat v6.0 ...", the setting is under the "Server Options" heading.

Starting tomcat in debug mode enables hot code replace.

Source: http://www.eclipse.org/forums/index.php?&t=msg&goto=523599

Stefan L