| Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 1 | Gerrit2 - Eclipse Setup |
| 2 | ======================= |
| 3 | |
| 4 | This document is about installing Gerrit into an Eclipse workspace |
| 5 | for development and debugging, especially with the GWT hosted |
| 6 | mode debugger. |
| 7 | |
| 8 | You will need to have the GWT (Google Web Toolkit) SDK installed on |
| 9 | your system. A Java 5 or later SDK is also required to run GWT's |
| 10 | compiler and runtime. |
| 11 | |
| 12 | GWT requires the Sun JDK (or OpenJDK). The GWT "hosted mode" |
| 13 | environment (Eclipse debugger or "make web-shell") does not work |
| 14 | under libgcj. |
| 15 | |
| 16 | |
| 17 | User Library |
| 18 | ------------ |
| 19 | |
| 20 | Create a user library called `GWT`: |
| 21 | |
| 22 | * Window > Preferences |
| 23 | * Java > Build Path > User Libraries |
| 24 | |
| 25 | * New |
| 26 | * Name: `GWT` |
| 27 | * Add JARs... |
| 28 | |
| 29 | * Select `gwt-user.jar` from the $(GWT_SDK) directory. |
| 30 | * Select `gwt-dev-$(OS).jar` from the $(GWT_SDK) directory. |
| 31 | |
| 32 | Maven Plugin |
| 33 | ------------ |
| 34 | |
| 35 | Install the Maven Integration plugins: |
| 36 | |
| 37 | http://m2eclipse.codehaus.org/[m2eclipse] |
| 38 | |
| 39 | |
| Shawn O. Pearce | e89544b | 2009-04-28 07:59:44 -0700 | [diff] [blame^] | 40 | Code Formatter Settings |
| 41 | ----------------------- |
| 42 | |
| 43 | Import GoogleFormat.xml using Window -> Preferences -> Java -> |
| 44 | Code Style -> Formatter -> Import... |
| 45 | |
| 46 | This will define the 'Google Format' profile, which the project |
| 47 | settings prefer when formatting source code. |
| 48 | |
| 49 | |
| Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 50 | Import Projects |
| 51 | --------------- |
| 52 | |
| Shawn O. Pearce | 263786e | 2009-02-02 15:49:26 -0800 | [diff] [blame] | 53 | Import pom.xml using General -> Maven Projects |
| Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 54 | |
| Shawn O. Pearce | b951af1 | 2009-02-06 12:32:18 -0800 | [diff] [blame] | 55 | If you also want source projects for gwtorm, gwtjsonrpc or sshd, |
| Shawn O. Pearce | 4555a3b | 2009-01-26 11:35:02 -0800 | [diff] [blame] | 56 | import their top-level directories the same way. Note that you |
| Shawn O. Pearce | 263786e | 2009-02-02 15:49:26 -0800 | [diff] [blame] | 57 | may need to edit the pom.xml under gerrit to ensure your snapshot |
| Shawn O. Pearce | 4555a3b | 2009-01-26 11:35:02 -0800 | [diff] [blame] | 58 | builds are used. |
| Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 59 | |
| Shawn O. Pearce | 4555a3b | 2009-01-26 11:35:02 -0800 | [diff] [blame] | 60 | [NOTE] |
| 61 | If you import gwtorm, you also need to right click on `gwtorm`, |
| 62 | Maven -> Update Project Configuration to force a compile of |
| 63 | the generted ANTLR sources. This should fix the compile errors |
| 64 | identified after import. |
| 65 | |
| 66 | If you also want a source project for JGit, import the top level |
| 67 | jgit directory using General -> Existing Projects, selecting only |
| 68 | the `org.spearce.jgit` and `org.spearce.jgit.test` projects. |
| Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 69 | |
| 70 | |
| 71 | Configure Database |
| 72 | ------------------ |
| 73 | |
| 74 | You may have already done this step earlier, based on the |
| 75 | instructions in link:dev-readme.html[Developer Setup]. |
| 76 | |
| Shawn O. Pearce | 10a52b3 | 2009-02-09 08:12:54 -0800 | [diff] [blame] | 77 | * Open gerrit/src/main/java |
| Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 78 | * Copy `GerritServer.properties_example` to `GerritServer.properties` |
| 79 | * Configure your database for debugging in hosted mode. |
| 80 | |
| Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 81 | |
| 82 | Launch Gerrit |
| 83 | ------------- |
| 84 | |
| 85 | Open Run->Debug Configurations... |
| 86 | |
| 87 | Under Java Application find `gerrit_debug` (not Mac OS X) |
| 88 | or `gerrit_macos` (Mac OS X only) to start the GWT hosted |
| 89 | mode browser and debug through Eclipse. |