4
votes

I'm building a system using a Gradle multi-project build. So far we have multiple projects working fine, using the Java and Eclipse Plugins. I'm really impressed with how simple this was and the fact that Eclipse and Gradle play so well together.

We need to add a user interface to our system and have decided to go with a GWT project, so I want to add this as another sub-project of my gradle build.

I've played with GWT using it's Eclipse plugin and building it from the command line with the Ant build scripts generated by GWT. This all works great, but when I try to combine Eclipse, GWT and Gradle I can't figure out how to do this.

I want gradle to manage my dependencies both from the command line and eclipse, because I will have dependencies on other sub projects. But when I find solutions online for doing gradle builds of GWT they usually involve moving the src structure away from the GWT structure to match Gradle's, this breaks the GWT plugin for eclipse.

Can anyone point me at a way to create a new GWT project which can be built by gradle and use it's dependency management system and that will work in Eclipse, so that the eclipse classpath is updated to reflect the dependencies in Gradle and I can still use the GWT plugin for launching and debugging the app?

1
Out of curiosity: are you using the Gradle Integration plugin for Eclipse by SpringSource/Pivotal? or only "gradle eclipse" to generate the Eclipse project files? - Thomas Broyer

1 Answers

1
votes

It took a while and a lot of digging around, but I found a relative solution to get GWT working (Debuggable/runnable) from Eclipse. Mind the fact that this uses GAE as a backend and that it does conform the the source paths that Gradle expects. It doesn't use the GWT Eclipse plugin, but the Eclipse profile below is still able to get everything going. It's a bit of a convoluted setup, but it does work. You can see my blog article for full details and link to a sample app, but I've posted the specific details for your scenario below.

Specifically, I used SDBG (http://sdbg.github.io/) as the debugging tool for SuperDevMode (GWT >= 2.7) within Eclipse. I also used a Gradle Plugin for GWT (https://github.com/steffenschaefer/gwt-gradle-plugin). There are other commands in this plugin that will take the place of most features available in the GWT Eclipse Plugin.

Once you have your project all set up (including a functional build.gradle), create the SDBG Profile (Debug Config->Launch Chrome). Fill in the appropriate fields: Project and the link (eg. http://localhost:8085/EGGG.html) Then run the following gradle commands (from Eclipse):

  • appengineRun (gets the server up and running to serve the GWT files)
  • gwtSuperDev (creates the client SDM connection).

Then debug the SDBG Profile you just created. A new Chrome window opens. Turn on Dev Mode (See GWT's SuperDevMode documentation for details) and now debugging works (with breakpoints set in Eclipse).