I've struggled for about a week with GWT and Maven, and I figured it would be a good time to step back and look for some general advice, especially from folks who have been successful with GWT so far.
Up to this point, I've been using Struts 2, Spring, and JPA (backed by hibernate) for my Java-based web development. I have also found that Maven 2 is a genuinely excellent tool to manage the build. It took a while to learn and set up, but by this point, I don't really want to go back to Ant. I'm pretty sold on Maven 2.
I started learning GWT about a week ago, and it looked great at first. I had no trouble doing the StockWatcher app, and I can easily see how to tie GWT in with the sort of work I've already been doing. My overall approach would be to create model objects for the GWT client side that don't rely on annotations or generics (or other things that can't work on the client), and shadow them with annotated classes that can persist through JPA, use Spring to manage transactions and do DI, and so forth.
Because I use Maven 2 to manage so much of my existing build, I was hoping that I could easily "mavenize" the stockwatcher application... and unfortunately, so far, I've had a very difficult time doing that. I checked out the Codehaus mvn plugin, which seems to be the most currently maintained one (the GWT-Maven plugin, according to the authors on the site, is planning to merge with codehaus).
Well, so far this seems like moving target, and the eclipse based approach on the GWT site is extremely well documented and easy to use... so easy that I'm starting to think that maybe I should just revert to using ant through eclipse for a while until the maven plugins are more stable and better documented. I'm very bummed to do this, though, because I find Maven 2 to be an excellent build tool, and I also don't like relying so heavily on Eclipse (I use it when I build with Maven 2, but I like the fact that I can go to the command line whenever I want... fortunately, the ant build used by GWT does run well on the command line, with isn't always the case with Eclipse plug-ins).
So at this point, I just want to solicit some advice from anyone who has experience with these issues...
Has anyone out there successfully used the Maven 2 archetypes to create a GWT app, especially one that uses JPA and/or Spring on the server?
Has anyone successfully done this with the Eclipse/Ant method used for the tutorials on the main google gwt site?
If you're experienced with this, what approach would you recommend for now? Keep butting my head against mvn, or stick with what the google guys are doing for the moment?
All pretty general, but I'd really appreciate any feedback, because I'm kind of spinning my wheels here...
Maven is a great tool that gives you the ability to make projects that fit your IDE, compile/deploy your files, download jars, etc...
Although it has many advantages I think that It could not help you with GWT.
Those files will contain your GUI components, such as Grids, Tabs, Trees....
Once this files are generated, you won't need any more the GWT engine jars.
In fact, adding GWT jars to your deployment war file could cause you a lot of exceptions.
Your war file will need to include these generated files and thats all (you should put them yourself in the war after their creation).
In development time you will have in your src-->main-->java , the GWT directory that contains "client" and "server" directories.
The GWT compiler will create the js files out from the "client" directory.
The problem is that the client directroy does not recognize the JPA annotations. for that I recommend to read the last section in the following link:
http://code.google.com/webtoolkit/articles/using_gwt_with_hibernate.html and the link:
http://www.ningzhang.info/gwtpersistence I recommend also to download JEE IDE such as Eclipse Galileo (version 3.5) and install the GWT plugin in it.
This will allow you to create GWT sample project that you could merge into your maven archetype generated project.
If you are interested in rich ajax GWT based framework, you have the GXT (also called Extended GWT) which is open source, or smartclient that will cost you some money.
You can download demos and learn a lot from them.
I hope I helped you.
posted 10 years ago
I child proofed my house but they still get in. Distract them with this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop