Back to maven development

I have recently mavenized some of my GWT projects. It has been a long time since the last time I touched maven on any machine (7 maven minor releases to be exact).

Let’s begin with my objectives:

  • build my GWT app everywhere, anywhere and without hassle. I do not want to edit my web.xml after packaging, and I needed some special assemblies which I definitely did not want to build using ant.
  • after hours of tapping in the dark, we found that our application was not running because we were packaging a jar in the wrong version. I need the single source of truth regarding dependency management, dependency mediation.
  • I wanted to do the -server thing with GWT. Not only because it’s cool, but there are some very good reasons for that:
  • The GWT development shell startup time is reduced by the tomcat (+backend) startup time
  • The GWT development gets too slow when running the tomcat embeded (at least on the machines I had at hand)
  • I can restart the frontend without having to restart the backend
  • I can restart the backend without having to restart the frontend

Specially the last to improvements are very productive. Most of my code changes are either backend or frontend, so it does not make sense to have to restart both of them at the same time.

Nonbelievers would complain about the packaging, deployment and startup time when running tomcat externally. Yes, I agree, here is where I very happy to know maven good enough to solve this problem. I am not using tomcat during development. There is a jetty plugin that starts up jetty and runs the application without packaging and deployment – directly from the compiled sources and resources from the project layout. This speeds up deployment and application startup tremendously. Basically I only have the maven startup + backend startup times, since jetty starts almost instantaneously.

One drawback I surely have is that most GWT libraries are not build by maven and are not available in any repository. So I did setup a svn repository where I can check-in those artifacts. The svn approach makes it easy for me to maintain the repository and have it shared out of the box. Dreaming: Google could start a maven repository service for GWT libraries with full search capabilities, that would be great. Until then we will have fun with the command line “mvn install-file -D… -D…. -D…”

So here comes the short list of links that helped me setup the project and my environment properly. Hope I have them all…

TOOLS

Open the command line directly from eclipse. Works like “command prompt here” for windows, very usefull
http://pluginbox.sourceforge.net/plugins.html

Plugin for Eclipse: Q4E Plugin (moving to eclipse in the future)
http://q4e.googlecode.com/
Update site: http://q4e.googlecode.com/svn/trunk/updatesite/

Oh, I almost forgotten: Maven itself!
http://maven.apache.org/

The GWT maven plugin
http://code.google.com/p/gwt-maven/

The Jetty maven plugin
http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin

Tutorials, Documentation

Well, obviously you will have to have a look at the documentation provided by GWT, Maven and the plugins. Won’t mention them here separately. Maven is a great tool, but it is not as simply as maven and it does have a high impact in development and infrastructure, as it is much more then ant. Be warned!

Doing the Google Web Toolkit -noserver thing

The Three Amigos – Maven, Spring and GWT

The GWT Developer Guide (online)

One thought on “Back to maven development”

  1. I recently managed to have the GWT artifacts deployed automatically into the running jetty…

Leave a Reply

Your email address will not be published. Required fields are marked *