I'm looking for the best way how to use Tomcat in Eclipse with Maven.

I have some experience developing Java EE applications and I'm expecting similar behavior when using Maven.

My requirements are simple:

  • easy application building
  • easy deployment
  • if possible, hot swap

I do not know how Tomcat + Eclipse work in detail so I assumed that Maven command

mvn eclipse:eclipse -Dwtpversion=2.0

setups everything correctly, but I've got suspicion it's not working well (or at least as expected).

When project (let's call it test) is built in maven, result is in ${project}/target/test folder. But it seems to me that classes for Tomcat are from different folder (${project}/target/classes ?). This is IMHO wrong (correct me if I'm wrong), but maven can do other actions before building classes - code generation, resource filtering, AOP weaving and so on.

Are there some recommendations how to use it? Because performing mvn clean install from command line and deploying the result to Tomcat doesn't sound to me as IDE (Integrated development environment). It is possible to instruct maven eclipse plugin to setup it correctly?

I also tried to use mvn tomcat:run but here I'm completely lost, I'm getting errors I do not understand f.e.

java.lang.NoSuchMethodError: org.apache.cxf.common.classloader.ClassLoaderUtils.loadClass

and I have no idea why it's not working while using server runtime for tomcat 6 works fine from eclipse.

Is it possible to instruct Eclipse to perform let say mvn install when I save the class? Will it work than? Will that be quick enough (rebuilding only changed things + dependencies as I'm used to from standard JSE projects)?

Actually I'm using

Edit
Report