| 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 | |
| Shawn O. Pearce | d15fe29 | 2009-07-21 09:52:09 -0700 | [diff] [blame] | 8 | You will need to have the GWT (Google Web Toolkit) 1.7 SDK installed |
| Shawn O. Pearce | fa0c753 | 2009-05-12 17:22:08 -0700 | [diff] [blame] | 9 | on your system. A Java 6 or later SDK is also required to run |
| 10 | GWT's compiler and runtime. |
| Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 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 | |
| Shawn O. Pearce | d15fe29 | 2009-07-21 09:52:09 -0700 | [diff] [blame] | 20 | Create a user library called `GWT_17`: |
| Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 21 | |
| 22 | * Window > Preferences |
| 23 | * Java > Build Path > User Libraries |
| 24 | |
| 25 | * New |
| Shawn O. Pearce | d15fe29 | 2009-07-21 09:52:09 -0700 | [diff] [blame] | 26 | * Name: `GWT_17` |
| Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 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 | |
| Shawn O. Pearce | 44671f5 | 2009-11-07 12:55:26 -0800 | [diff] [blame^] | 43 | Import `tools/GoogleFormat.xml` using Window -> Preferences -> |
| 44 | Java -> Code Style -> Formatter -> Import... |
| Shawn O. Pearce | e89544b | 2009-04-28 07:59:44 -0700 | [diff] [blame] | 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] |
| Brad Larson | c2461af | 2009-09-09 11:47:09 -0500 | [diff] [blame] | 61 | Some of the source code is generated with ANTLR sources. To |
| Shawn O. Pearce | 44671f5 | 2009-11-07 12:55:26 -0800 | [diff] [blame^] | 62 | build these files, you need to right click on the imported projects, |
| Brad Larson | c2461af | 2009-09-09 11:47:09 -0500 | [diff] [blame] | 63 | Maven -> Update Project Configuration. This should fix the compile |
| 64 | errors identified after import. |
| Shawn O. Pearce | 4555a3b | 2009-01-26 11:35:02 -0800 | [diff] [blame] | 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 | 44671f5 | 2009-11-07 12:55:26 -0800 | [diff] [blame^] | 77 | * Navigate to gerrit-war/src/main/webapp/WEB-INF/extra/ |
| 78 | * Copy `GerritServer.properties_example` to `gerrit-parent/GerritServer.properties` |
| Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 79 | * Configure your database for debugging in hosted mode. |
| 80 | |
| Shawn O. Pearce | 8d2f184 | 2009-05-13 07:59:04 -0700 | [diff] [blame] | 81 | Production Compile |
| 82 | ------------------ |
| 83 | |
| 84 | *Always* use |
| 85 | |
| 86 | ---- |
| 87 | mvn clean package |
| 88 | ---- |
| 89 | |
| Shawn O. Pearce | 44671f5 | 2009-11-07 12:55:26 -0800 | [diff] [blame^] | 90 | to create a production build. |
| Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 91 | |
| 92 | Launch Gerrit |
| 93 | ------------- |
| 94 | |
| Shawn O. Pearce | d607846 | 2009-11-02 10:37:01 -0800 | [diff] [blame] | 95 | Open Run->Debug Configurations... |
| Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 96 | |
| Shawn O. Pearce | 44671f5 | 2009-11-07 12:55:26 -0800 | [diff] [blame^] | 97 | Under Java Application find `gwtui_any` (not Mac OS X) |
| 98 | or `gwtui_mac` (Mac OS X only) to start the GWT hosted |
| Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 99 | mode browser and debug through Eclipse. |
| Shawn O. Pearce | 06b48c3 | 2009-05-10 16:21:05 -0700 | [diff] [blame] | 100 | |
| Shawn O. Pearce | 06b48c3 | 2009-05-10 16:21:05 -0700 | [diff] [blame] | 101 | Final Setup |
| 102 | ----------- |
| 103 | |
| 104 | Since you are creating a Gerrit instance for testing, you need to |
| 105 | also follow the other steps outlined under "Initialize the Schema" |
| 106 | in the Installation Guide. Note that the database has already been |
| 107 | created if you launched Gerrit at least once. |
| 108 | |
| 109 | Note that Bouncy Castle Crypto is automatically installed in the |
| 110 | classpath when debugging with hosted mode, so you will need to |
| 111 | create SSH keys with `ssh-keygen`. |
| 112 | |
| 113 | * link:install.html[Installation Guide] |
| 114 | * link:project-setup.html[Project Setup] |
| Shawn O. Pearce | 5500e69 | 2009-05-28 15:55:01 -0700 | [diff] [blame] | 115 | |
| 116 | GERRIT |
| 117 | ------ |
| 118 | Part of link:index.html[Gerrit Code Review] |