Wednesday, July 29, 2015

Re: gwt-maven-archetypes multiple project setup

So I found a solution, but I am a little unclear why it works and what is the best practice. Before when it wasn't working I had this dependency in my server project:

When I removed the <type>gwt-lib</type> and rebuilt, it put the library-core-server.jar in the web-inf/lib directory which was put in the war and that made it work when I deployed the war.

Am I incorrectly using the  <type>gwt-lib</type>?
Is there a better way to make sure that jar gets put in the war?
Will anything not work correctly if I don't put in the  <type>gwt-lib</type>?


On Wednesday, July 29, 2015 at 9:41:05 AM UTC-4, William Davis wrote:
It is probably something simple but what do I need to do to get maven to put the jars of the libraries into the target/[app_name]/WEB-INF/lib directory, for building the war?

On Wednesday, July 29, 2015 at 8:52:57 AM UTC-4, William Davis wrote:
So I figured out that if I do a maven install a war is generated in the server project, however my servlet classes from the libraries were not copied into the war. Still looking into that...

On Tuesday, July 28, 2015 at 10:27:34 AM UTC-4, William Davis wrote:
So the good news is that everything is running well, the incremental compile is working for all the libraries client and server side. I am very impressed with the plugin Thomas.

One last question, what is the correct way to package the whole app into a war for production. I tried to run gwt:package-app on the parent project, the one containing the client, shared, and server projects in the modular-webapp archetype, however when I put the war on tomcat it didn't work. Should I install the projects and libraries in a certain order? What am I doing wrong?

Once again, great work Thomas, this is really excellent.
Thanks for the help,

On Friday, July 24, 2015 at 10:42:19 AM UTC-4, Thomas Broyer wrote:

On Friday, July 24, 2015 at 4:13:45 PM UTC+2, William Davis wrote:
I think I figured something out. In the "base" project, in the parent pom, I only defined the three modules in that project like this:

but I changed it to add the client library like this:

and now the incremental compile works when I make changes to the library client.
Is this the correct/best way to do this?

With your initial setup, the library-core-client (and its transitive dependencies) come from your local repository, and you have to "mvn install" the library each time you make a change to it.
With your final setup, it's all one reactor project (you should include the library-core-shared and library-core-server too BTW), so the gwt-maven-plugin will look at the MavenProject from the reactor build to get its sources.

Your initial setup is OK if you intend to release library-core-* separately from the "base" webapp.
Your final setup is OK if you intend to release everything at once. I'd have rather put everything inside one big project with many submodules (organized into subfolders), but in the end it's up to you to decide.
Note that there's a way to get things working with your initial "2 separate projects" approach though: create a POM file somewhere that lists all modules as submodules (note: you can just list the 2 root modules of your 2 projects and thus get the submodules recursively) and from which one you can run the tomcat7:run and gwt:codeserver goals.

This is all "standard Maven", independent of the gwt-maven-plugin (you'd get the same behavior for server-side code with the tomcat-maven-plugin, not seeing changes to your library-core-shared and library-core-server until you "mvn install" them and restart Tomcat).

You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment