# Gerrit Code Review - Eclipse Setup

version v2.10.2-20-g8f63e71

This document is about configuring Gerrit Code Review into an Eclipse workspace for development and debugging with GWT.

Java 6 or later SDK is also required to run GWT’s compiler and runtime debugging environment.

## Code Formatter Settings

Import `tools/GoogleFormat.xml` using Window → Preferences → Java → Code Style → Formatter → Import…

This will define the Google Format profile, which the project settings prefer when formatting source code.

## Site Initialization

Build once on the command line with Buck and then follow Site Initialization in the Developer Setup guide to configure a local site for testing.

## Testing

### Running the Daemon

Duplicate the existing launch configuration:

- Run → Debug Configurations …

- Java Application → `gerrit_daemon`

- Right click, Duplicate

- Modify the name to be unique.

- Switch to Arguments tab.

- Edit the `-d` program argument flag to match the path used during init. The template launch configuration resolves to ../gerrit_testsite since that is what the documentation recommends.

- Switch to Common tab.

- Change Save as to be Local file.

- Close the Debug Configurations dialog and save the changes when prompted.

### Running Hosted Mode

Duplicate the existing launch configuration:

- Run → Debug Configurations …

- Java Application → `buck_gwt_debug`

- Right click, Duplicate

- Modify the name to be unique.

- Switch to Arguments tab.

- Edit the `-Dgerrit.site_path=` VM argument to match the path used during init. The template launch configuration resolves to ../gerrit_testsite since that is what the documentation recommends.

- Switch to Common tab.

- Change Save as to be Local file.

- Close the Debug Configurations dialog and save the changes when prompted.

## Known problems

- OpenID authentication won’t work in hosted mode, so you need to change the auth.type configuration parameter to `DEVELOPMENT_BECOME_ANY_ACCOUNT` to disable OpenID and allow you to impersonate whatever account you otherwise would’ve used.

- Error "Cannot create ReviewDb" occurs if the test site is already running. Stop the test site with `gerrit.sh stop` before attempting to run hosted mode debugging.

- Gerrit site doesn’t appear, only directory listing is shown. Web toolkit developer browser plugin is missing. If there is no warning, that browser plugin is missing with the suggestion to install it, you can install the right extension for your browser from the following locations:

  Chrome

  Firefox

  IE

  Safari

Part of Gerrit Code Review