Saturday, February 11, 2012

maven web app development

I came to point where I needed to build simple java based web application that would have as short as possible deployment time.

OK this is the way I had to follow, hope it can help to make your path simple :)

1. The first decision I made was to go for embedded web server => Jetty can do the job.

2. Maven and jetty are friends => can be run using: jetty:run
config details can be found on:
http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin

Where the benefit is that you won't even need to build war (save quite some time during deployment), to have your web app up and running.

3. But I needed to debug when launching from eclipse (using m2e plugin).
Tried a solution with m2e having: MAVEN_OPTS set + remote app debug, as suggested:
http://docs.codehaus.org/display/JETTY/Debugging+with+the+Maven+Jetty+Plugin+inside+Eclipse

this however didn't work for m2e, seems I'm not the only person with this problem, see: http://comments.gmane.org/gmane.comp.ide.eclipse.plugins.m2eclipse.user/7565


4. So I tried: m2e-webby integration:
https://docs.sonatype.org/display/M2ECLIPSE/Integration+with+Maven+WAR+Plugin
and it works great!
It even reads my pom.xml jetty relevant config.

Feel free to spread your experiences in comments section with java web apps development and what is your perfect setup.

2 comments:

Anonymous said...

Hi Peter :)

Do you have experience to run webby with jetty 9.0? Is it possible?

Peto B said...

Hi,

well, I don't have experience with this combination.
But based on eclipse update site: http://m2eclipse.sonatype.org/sites/m2e-webby/plugins/ there seems to be no support for jetty 9.

However, it's a question if you want to go for eclipse + webby, as described here, or for another combination: eclipse + wtp + m2e_wtp, that I blogged about couple days ago: http://peter-butkovic.blogspot.de/2012/12/jumpstart-with-eclipse-maven-and-tomcat.html

As there seem to be also wtp connector for jetty: http://wiki.eclipse.org/Jetty_WTP_Plugin
however it doesn't mention jetty 9 integration either (unfortunatelly).

So I'd be quite curious to know what you end up with :)