Lured by code.https://jgonian.wordpress.com
Practicing the art of software design & maintenanceSun, 18 Mar 2018 03:43:23 +0000enhourly1http://wordpress.com/https://s2.wp.com/i/buttonw-com.pngLured by code.https://jgonian.wordpress.com
GWT + Maven + GPE gotchashttps://jgonian.wordpress.com/2011/05/21/gwt-maven-gpe-gotchas/
https://jgonian.wordpress.com/2011/05/21/gwt-maven-gpe-gotchas/#commentsSat, 21 May 2011 20:05:24 +0000http://jgonian.wordpress.com/?p=21Continue reading →]]>Lately, the support of Maven for the Google Plugin for Eclipse (GPE) has been enhanced. Since GPE 2.1, you can File | Import… | Existing maven project, point it to your POM, and everything should just work. You can start the development mode without running any additional goals like ‘mvn eclipse:eclipse’ anymore. Or at least this is what I ‘d like to see happening while trying out the new GPE, but…

GEP fails to locate module descriptor in “src/main/resources”Maven2 philosophy dictates that all non-java resources that should be available on the classpath should reside on “src/main/resources”. While placing your gwt.xml file under “src/main/resources” will work with ‘mvn gwt:run’, GPE will fail to discover it even if the <module/> configuration property of the gwt-maven-plugin has been specified. No matter what, running your app in Eclipse (Run | Run As | Web Applicaiton) will result in the following error:

This one turned out to be a known GPE issue (Issue 3759) and the recommended workaround is to place your GWT module descriptor in “src/main/java”.

Contents of “src/main/webapp” are not getting copied to the hostedWebapp *Solved*While running the development mode server the resources of “src/main/webapp” are expected to be found under the hostedWebapp directory (i.e. target/${project.build.finalName}) and using the copyWebapp configuration property should have copied them. Unfortunately, this is still not working for me and I ‘ve experienced errors like FileNotFoundExceptions and 404 errors despite using the AppEngineLauncher or the internal Jetty server.To get around this, I have to run ‘mvn war:exploded‘ before starting the development mode. Read also this FAQ entry.
—Update: As commented by David Chandler, in order for the GPE to copy the “src/main/webapp” to the hostedWebapp directory, you need to have the m2extras’ “Maven Integration for WTP” plugin installed as well as m2eclipse. Here is the m2extras update site: http://m2eclipse.sonatype.org/sites/m2e-extras

No App Engine SDKs found on the build pathThis is a minor but annoying one. GPE will search your POM’s dependencies for a GAE SDK and if it doesn’t find one (let’s say because you don’t use GAE), Eclipse will report the following problem:

Google App Engine Problem (1 item)
> The project 'xxx' does not have any App Engine SDKs on its build path

To get rid of it you can either go to Project | Properties | Google | App Engine and deselect ‘Use Google App Engine’ or consider adding a dependency for GAE SDK in your POM

]]>https://jgonian.wordpress.com/2011/05/21/gwt-maven-gpe-gotchas/feed/8jgonianEfficient GWT development: Swap your gwt.xml with maven.https://jgonian.wordpress.com/2011/02/24/efficient-gwt-development-swap-your-gwt-xml-with-maven/
https://jgonian.wordpress.com/2011/02/24/efficient-gwt-development-swap-your-gwt-xml-with-maven/#commentsThu, 24 Feb 2011 19:41:32 +0000http://jgonian.wordpress.com/?p=28Continue reading →]]>A module in GWT bundles together all the configuration settings that your GWT project needs. A common practice is to have a “development” module along with your “production” module in order to toggle the configuration of your application.

There are many scenarios where this kind of setup would become handy.
For example, the production module for a possible project, name it Example.gwt.xml could be like this:

Ok, now we need an easy way to swap our gwt.xml files based on our working environment. This can be easily achieved with Maven by using build profiles. Although, I believe it should be trivial to achieve a similar setup with ant as well.

So, lets configure our POM to use the development configuration by default (for everyday development) and add a profile to activate the production configuration in order use it e.g. on the Continuous Integration server or when we need to deploy to a staging environment. To achieve this we modify the gwt-maven-plugin section:

]]>https://jgonian.wordpress.com/2011/02/24/efficient-gwt-development-swap-your-gwt-xml-with-maven/feed/7jgonianMaven Checkstyle and Eclipsehttps://jgonian.wordpress.com/2010/12/12/maven-checkstyle-and-eclipse/
https://jgonian.wordpress.com/2010/12/12/maven-checkstyle-and-eclipse/#commentsSun, 12 Dec 2010 09:58:25 +0000http://jgonian.wordpress.com/?p=3Continue reading →]]>Have you ever tried to setup your multi-module Maven project with a shared checkstyle configuration and connect it to your eclipse IDE? If you have, I am sure you ‘d agree that it was not as trivial as it should be…

Recently, I had the opportunity to help with the maven-ization of gwt-platform. It used to be a single ant-build project with Checkstyle setup. Also, this setup was working fine in Eclipse without particular manual effort. With the migration to maven the project was split into many sub-modules and a single Checkstyle configuration consisting of: config, header and suppressions files. If this is what you are searching for then stay tuned.

The first step is to share Checkstyle configuration among the sub-modules. You should create a separate host project for the shared Checkstyle configuration. Then you add it as a dependency to maven-checkstyle-plugin e.g.

In the above snippet, you might noticed that Eclipse will look for the target/checkstyle-checker.xml file which is created by maven-checkstyle-plugin when checkstyle goal runs. For that reason, checkstyle goal should run before the execution of eclipse:eclipse. Also, you should take into account that maven-eclipse-plugin will invoke the execution of the lifecycle phase generate-resources before executing itself.
Apparently, a suitable lifecycle phase to run checkstyle is the validate phase e.g.

We are almost there… Now you should make sure your checkstyle configuration is found properly inside eclipse (in particular your header and suppression files). Unfortunately, eclipse will not resolve relative paths inside your Checkstyle configuration file resulting in errors e.g.

You need to wire the header and the suppressions file into your Checkstyle configuration in an Eclipse friendly manner i.e. use full paths

After struggling for a while with various tweaks (like this one) I found a relative clean workaround which works with both, Eclipse and Maven.

PS1. I found a similar approach in Apache CXF, which I found it in some extend complicated since it is using a combination of ant, xslt, and the ‘copy’ task to create all of the desired settings files.