Skip to content

Setting up Eclipse Development Environment

objectiser edited this page Nov 17, 2014 · 4 revisions

Use the instructions on the project main page to checkout the project, build the code and run the UI in mock mode. Once this has been done, we can go ahead and set up an Eclipse environment.

First the basics:

  • Download and unzip Eclipse 4.3.x

  • Launch Eclipse 4.3.x

  • Install the “Google Plugin for Eclipse 4.3” from the Eclipse Marketplace (search for Google). Feel free to de-select the following options that you won’t need:

    • Google App Engine Java SDK

    • Google App Engine Tools for Android

    • GWT Designer Core

    • GWT Designer Editor

    • GWT Designer GPE

  • Import → Maven / Existing Maven Projects

    • Choose the path to your cloned rtgov git repository

    • Finish

  • Wait for the automatic Eclipse build :)

Note
As there are many modules in the rtgov git repo, it may be necessary to import them into Eclipse in groups, otherwise m2e can be overwhelmed, resulting in out of heap issues. We would suggest starting with the modules folder first, then integration, content, samples and ui.

Now that the project code is imported into Eclipse, we can set up a couple of Launch Targets to get us going with iterative development.

In order to debug the UI code you will need three things:

  • The web application running in a server (e.g. Tomcat, JBoss, Jetty)

  • The Errai/GWT UI code hosted in a code server (i.e. GWT Dev Mode)

  • Google’s GWT plugin for your browser

Note
you need to do all of these bullets to get the UI working in Dev Mode - just doing bullet 1 will most likely result in a blank page in the browser.

To make the first bullet easier, we have created a simple embedded Jetty harness. To create a launch target for this, follow these instructions:

  • Debug → Debug Configurations

  • New Java Application launch

    • Give it a name

    • Set Main → Project to overlord-rtgov-ui-dev-server

    • Set Main → Main Class to org.overlord.rtgov.devsvr.RTGovUIDevServer

    • Set Arguments → VM arguments to -javaagent:${resource_loc:/overlord-rtgov-ui-dev-server/lib/client-local-class-hider.jar}

    • Add overlord-rtgov-ui-base and overlord-rtgov-ui-eap6 projects, and the rtgov-ui-core project, to Classpath → User Entries

When you run this launch target, you should get a clean startup culminating in the following output:

----------  DONE  ---------------
Now try:
http://localhost:8080/rtgov-ui/index.html
---------------------------------

Reminder: despite this message, hitting that URL at this point will likely result in a blank UI.

Next, we need another launch target for bullet #2 above. This is accomplished by using the Google Plugin for Eclipse. There are two steps to this. First you must configure the overlord-rtgov-ui-war project to be a GWT project. Then you must create a GWT Dev Mode launch target.

To configure the overlord-rtgov-ui-base project do this:

  • Right-click on overlord-rtgov-ui-base and choose Properties

    • Google / Web Toolkit → Use Google Web Toolkit (checked)

    • Google / Web Toolkit → Entry Point Modules → Add…

      • Choose the only option

    • Google / Web Application → This project has a WAR directory (checked)

    • Google / Web Application → WAR directory set to src/main/webapp

    • Google / Launch and deploy from … (unchecked)

  • OK

Once that’s done, you can create a GWT Dev Mode launch target:

  • Debug → Debug Configurations

  • New Web Application launch

    • Give it a name

    • Set Main → Project to overlord-rtgov-ui-war

    • Set Main → Main class to com.google.gwt.dev.DevMode

    • Uncheck Server → Run built-in server

    • Set GWT → URL to http://localhost:8080/rtgov-ui/index.html

    • Ensure GWT → Available Modules has a value (App - org.overlord.rtgov.ui)

  • Note: when running this launch target you may be prompted for a WAR directory - choose the src/main/webapp directory from overlord-rtgov-ui-war

Now you may startup both Launch Targets and then point your browser here:

http://localhost:8080/rtgov-ui/index.html?gwt.codesvr=127.0.0.1:9997

Please note the “?gwt.codesvr=127.0.0.1:9997” bit at the end of the URL. This tells the application to connect to the GWT Dev Mode code server rather than attempt to use the compiled GWT javascript code natively.

Also note that you should now have a Development Mode view in Eclipse. That will show you some pertinent information about your application as it is running in GWT Dev Mode.

The first time you point your browser at the above URL you should be prompted to install the Google GWT Dev Mode browser plugin.

Once that is done everything should work (albeit more slowly than when run in native compile JavaScript mode). You can also set breakpoint in all the java code and those breakpoints will get hit (assuming you are running both launch targets in Debug mode).