If you read my OJ article on GWT, you saw the first version of the maven plugin. It has been updated since then, but we have been somewhat… negligent in releasing. So there is a new version avialable at our Google Code site.
Details after the bump.
The 1.0.3 version of the Maven 1 plugin is available in the repo. To install:
maven plugin:download
-DgroupId=com.totsp.gwt
-DartifactId=maven-googlewebtoolkit-plugin
-Dversion=1.0.3
-Dmaven.repo.remote=http://gwt-maven.googlecode.com/svn/trunk/mavenrepo/
This is a greatly enhanced version of the original. It includes several new features:
goal: gwt:mergewebxml
This goal will take the servlets declared in your GWT module and add them to the web.xml file in the target/webapp (or whatever) directory. This means you only have to declare your servlets in the gwt.xml file, not in both places. To go along with this, you can use:
goal: gwt:war
To spit out a ready-to-go war file.
Also, the default targets of gwt and gwt:debug have been enhanced. They will both now build a tomcat directory under “google.webtoolkit.tomcat”, defaults to target/tomcat. This will include your context.xml in the right place, and take the non-GWT elements defined in your web.xml file and add them to the web.xml file the shell runs with, so your whole application should run. You should note, however, that if you want to use Tomcat DataSources, you still need to include commons-dbcp and commons-pool as project dependencies, just set them to war.bundle=false. This will ensure they are there when the shell runs, but don’t end up in your war file.
There are some changes to the properties. First, the declaring of the dev-*.jar in the project.properties has gone away. We just add all of them to the classpath and hope you haven’t put multiple versions in the same directory!
Also new:
google.webtoolkit.tomcat : sets the root for catalina.base when shell runs.
google.webtoolkit.extrajvmarg : Passes additional JVM args when shell and debug run.
If you are using a mac, you want to run maven with
-Dgoogle.webtoolkit.extrajvmargs=-XstartOnFirstThread
or put it in your ~/build.properties file.
Charlie is working on an extended sample project with database access and some detailed docs.
I also want to mention that Eduardo Pereda has been added to the project to flesh out the Maven2 functionality that I have been neglecting for so long.



What about a Maven2 plugin ?
I've read somewhere that the GWT project itself has moved to Maven builds - but I can't remember if the version information was presented. It seems that most development efforts is on Maven2 these days so I think a plugin to support Maven2 is really needed. How much different is the code base for the plugins between the two versions?
Well, I mentioned Eduardo is taking up the Maven 2 version. Frankly if the documentation for Maven 2 wasn't breathtakingly bad, I would have done it long ago.
I saw that shinobu has done some work on a Maven2 plugin (see the entry at http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/7fbcb068975728af/4177033a5c452286?lnk=gst&q=maven+2&rnum=4#4177033a5c452286). How's that for a start?
Yeah, I looked at that as a starting point, and started working with it to match the functionality we have with maven 1, and have gone through the maven 2 docs on a couple of occasions to try and get a better feel for it.
Honestly, now that the maven 2 plugin-plugin has better Ant support, it should be a no-brainer to make an m2 plugin. The m1 plugin is really just using ant tags inside the Jelly script to accomplish everything. However...
I cannot find any information on getting settings meant for OTHER plugins from a different plugin.
For instance, when we forward merge the servlets from the hand written web.xml and the .gwt.xml files to the built out war we are using:
${maven.war.webxml}
To find the source and:
${maven.war.webapp.dir}/WEB-INF/web.xml
As best I can discern from the m2 docs, there is no way for my plugin to know what the settings are for the maven-war-plugin unless I just assume the defaults and have an insane number of configs for my plugin. With the current plugin, we can make those assumptions right in the plugin properties:
google.webtoolkit.gen=${maven.war.webapp.dir}
google.webtoolkit.tomcat=${maven.build.dir}/tomcat
Thanks for creating this. Would there be any chance of letting us know how to use it properly? I have been having problems all day trying to just get a war file out of it...
My partner Charlie is working on a sample project.
In terms of getting a war out of it, you should just have to do gwt:war, but if you are having problem, feel free to email me at kebernet@gmail.com
When I use the new 1.0.3 plugin with my old project which worked with the 1.0 version I get a "java.net.MalformedURLException: no protocol:" from my web.xml. The web.xml file itself seems fine. I've tried other examples and they all error in the same way. Googling has come up with little.
I'm using the example project from your earlier blog entry - http://www.onjava.com/pub/a/onjava/2006/05/31/working-with-google-web-toolkit.html?page=1
Hopefully you can help point out my obvious mistake. ;-)
Interesting. I am not sure where that would be coming from. You might look at:
http://gwt-maven.googlecode.com/svn/trunk/maven-googlewebtoolkit-sample/
as a template.
Hi Robert,
Thanks for your reply. Unfortunately, after changing my web.xml to resemble the one in your example the problem is still there,and the error is the same.
Any other suggestions? I'm wondering if it's something else about my environment but I'm on the same version of the GWT as your example uses. Maybe an XML parser library problem? The thing is my pproject doesn't use any parsers itself.
Regs, Andrew
ibiblio moved the repository to a mirror of some sort, a workaround is simply tacking the url at the back of the command. ie:
maven plugin:download
-DgroupId=com.totsp.gwt
-DartifactId=maven-googlewebtoolkit-plugin
-Dversion=1.0.3
-Dmaven.repo.remote=http://gwt-maven.googlecode.com/svn/trunk/mavenrepo/,
http://repo1.maven.org/maven
Hi,
i am trying to configure the maven-googlewebtoolkit-plugin.zip. I want to know the steps to do it.
as mentioned above
maven plugin:download
-DgroupId=com.totsp.gwt
-DartifactId=maven-googlewebtoolkit-plugin
-Dversion=1.0.3
-Dmaven.repo.remote=http://gwt-maven.googlecode.com/svn/trunk/mavenrepo/
what does these mean?
please help me
thanks
Check this plugin .
http://gwtforge.com