blob: 0840bd6a9cf97c4211a02ec7adee8a10ccb48f55 [file] [log] [blame]
Gerrit2 - Eclipse Setup
=======================
This document is about installing Gerrit into an Eclipse workspace
for development and debugging, especially with the GWT hosted
mode debugger.
You will need to have the GWT (Google Web Toolkit) 1.7 SDK installed
on your system. A Java 6 or later SDK is also required to run
GWT's compiler and runtime.
GWT requires the Sun JDK (or OpenJDK). The GWT "hosted mode"
environment (Eclipse debugger or "make web-shell") does not work
under libgcj.
User Library
------------
Create a user library called `GWT_17`:
* Window > Preferences
* Java > Build Path > User Libraries
* New
* Name: `GWT_17`
* Add JARs...
* Select `gwt-user.jar` from the $(GWT_SDK) directory.
* Select `gwt-dev-$(OS).jar` from the $(GWT_SDK) directory.
Maven Plugin
------------
Install the Maven Integration plugins:
http://m2eclipse.codehaus.org/[m2eclipse]
Code Formatter Settings
-----------------------
Import 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.
Import Projects
---------------
Import pom.xml using General -> Maven Projects
If you also want source projects for gwtorm, gwtjsonrpc or sshd,
import their top-level directories the same way. Note that you
may need to edit the pom.xml under gerrit to ensure your snapshot
builds are used.
[NOTE]
If you import gwtorm, you also need to right click on `gwtorm`,
Maven -> Update Project Configuration to force a compile of
the generted ANTLR sources. This should fix the compile errors
identified after import.
If you also want a source project for JGit, import the top level
jgit directory using General -> Existing Projects, selecting only
the `org.spearce.jgit` and `org.spearce.jgit.test` projects.
Configure Database
------------------
You may have already done this step earlier, based on the
instructions in link:dev-readme.html[Developer Setup].
* Open gerrit/src/main/java
* Copy `GerritServer.properties_example` to `GerritServer.properties`
* Configure your database for debugging in hosted mode.
Bootstrap Compile
-----------------
From the command line we have to bootstrap the environment:
----
./to_hosted.sh
----
Production Compile
------------------
*Always* use
----
mvn clean package
----
to create a production build. The `./to_hosted.sh` used above
to setup the development environment for Eclipse hosted mode also
creates a state that produces a corrupt production build.
Launch Gerrit
-------------
Open Run->Debug Configurations...
Under Java Application find `gerrit_debug` (not Mac OS X)
or `gerrit_macos` (Mac OS X only) to start the GWT hosted
mode browser and debug through Eclipse.
Final Setup
-----------
Since you are creating a Gerrit instance for testing, you need to
also follow the other steps outlined under "Initialize the Schema"
in the Installation Guide. Note that the database has already been
created if you launched Gerrit at least once.
Note that Bouncy Castle Crypto is automatically installed in the
classpath when debugging with hosted mode, so you will need to
create SSH keys with `ssh-keygen`.
* link:install.html[Installation Guide]
* link:project-setup.html[Project Setup]
GERRIT
------
Part of link:index.html[Gerrit Code Review]