Friday, December 14, 2012

jumpstart with eclipse, maven and tomcat (web/app server)

Q: What is the quick way to setup Eclipse war (possibly ear) project built with maven? 

A: In short: Eclipse + wtp + m2e + m2e-wtp

Sometimes from idea to it's realization is not an easy way.

If you're in a need to quickly setup java war project and you like the tools I do: maven, eclipse and tomcat (or any other server of your choice) following might be useful to jumpstart realizing your ideas.

My requirements

I've searched for a solution that would enable me to:
- use eclipse for application development
- manage server lifecycle directly from eclipse and
- use maven as a build tool.

My choice

Following has been found and based on the short project I've tested it with, it worked very well:
- eclipse - no doubts here (it's my favorite IDE for java development)
- wtp - fits me best for the server management directly from eclipse
- m2e - maven eclipse integration (as I'm in love with maven)
- wtp-m2e - wtp m2e integration (this one I've been missing in the puzzle, but only until today)

As  the last one mentioned was new to me the following video convicted me that it's something I need:

 
(the video is reffered on the official site as well)

After the initial project setup (depicted on the video) right clicking on the project and choosing "Run/Debug As" -> "Run/Debug on Server" does the job of publish and run/debug.

And once you change your project contents automatic republish happens in the background as well.

Sounds like the initial infrastructure setup time for my next project can be the question of seconds rather that hours.