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â€¦
Open the command line directly from eclipse. Works like â€ścommand prompt hereâ€ť for windows, very usefull
Plugin for Eclipse: Q4E Plugin (moving to eclipse in the future)
Update site: http://q4e.googlecode.com/svn/trunk/updatesite/
Oh, I almost forgotten: Maven itself!
The GWT maven plugin
The Jetty maven plugin
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!