After switch from bower components to npm modules, and removal of bazel filter from Jetty daemon, server.go process has to be launched to run gerrit from eclipse. Update the documentation and gerrit_daemon.launch correspondingly. Change-Id: I0905b55c0ae43b3816841018200059c96eeb5d09
114 lines
3.6 KiB
Plaintext
114 lines
3.6 KiB
Plaintext
:linkattrs:
|
|
= Gerrit Code Review - Eclipse Setup
|
|
|
|
This document is about configuring Gerrit Code Review into an
|
|
Eclipse workspace for development.
|
|
|
|
Java 8 or later SDK is required.
|
|
|
|
[[setup]]
|
|
== Project Setup
|
|
|
|
In your Eclipse installation's link:https://wiki.eclipse.org/Eclipse.ini[`eclipse.ini`,role=external,window=_blank] file,
|
|
add the following line in the `vmargs` section:
|
|
|
|
----
|
|
-DmaxCompiledUnitsAtOnce=10000
|
|
----
|
|
|
|
Without this setting, annotation processing does not work reliably and the
|
|
build is likely to fail with errors like:
|
|
|
|
----
|
|
Could not write generated class ... javax.annotation.processing.FilerException: Source file already created
|
|
----
|
|
|
|
and
|
|
|
|
----
|
|
AutoAnnotation_Commands_named cannot be resolved to a type
|
|
----
|
|
|
|
First, generate the Eclipse project by running the `tools/eclipse/project.py` script.
|
|
Then, in Eclipse, choose 'Import existing project' and select the `gerrit` project
|
|
from the current working directory.
|
|
|
|
Expand the `gerrit` project, right-click on the `eclipse-out` folder, select
|
|
'Properties', and then under 'Attributes' check 'Derived'.
|
|
|
|
Note that if you make any changes in the project configuration
|
|
that get saved to the `.project` file, for example adding Resource
|
|
Filters on a folder, they will be overwritten the next time you run
|
|
`tools/eclipse/project.py`.
|
|
|
|
=== Eclipse project with custom plugins ===
|
|
|
|
To add custom plugins to the eclipse project add them to `tools/bzl/plugins.bzl`
|
|
the same way you would when
|
|
link:dev-build-plugins.html#_bundle_custom_plugin_in_release_war[bundling in release.war]
|
|
and run `tools/eclipse/project.py`.
|
|
|
|
[[Newer Java versions]]
|
|
|
|
Java 9 and later are supported, but some adjustments must be done, because
|
|
Java 8 is still the default:
|
|
|
|
* Add JRE, e.g.: directory: /usr/lib64/jvm/java-9-openjdk, name: java-9-openjdk-9
|
|
* Change execution environment for gerrit project to: JavaSE-9 (java-9-openjdk-9)
|
|
* Check that compiler compliance level in gerrit project is set to: 9
|
|
|
|
[[Formatting]]
|
|
== Code Formatter Settings
|
|
|
|
To format source code, Gerrit uses the
|
|
link:https://github.com/google/google-java-format[`google-java-format`,role=external,window=_blank]
|
|
tool (version 1.7), which automatically formats code to follow the
|
|
style guide. See link:dev-crafting-changes.html#style[Code Style] for the
|
|
instruction how to set up command line tool that uses this formatter.
|
|
The Eclipse plugin is provided that allows to format with the same
|
|
formatter from within the Eclipse IDE. See
|
|
link:https://github.com/google/google-java-format#eclipse[Eclipse plugin,role=external,window=_blank]
|
|
for details how to install it. It's important to use the same plugin version
|
|
as the `google-java-format` script.
|
|
|
|
== Site Initialization
|
|
|
|
Build once on the command line with
|
|
link:dev-bazel.html#build[Bazel] and then follow
|
|
link:dev-readme.html#init[Site Initialization] in the
|
|
Developer Setup guide to configure a local site for testing.
|
|
|
|
|
|
== Testing
|
|
|
|
=== PolyGerrit UI is served by `server.go` process. To launch it,
|
|
run this command:
|
|
|
|
----
|
|
$ bazel run polygerrit-ui:devserver
|
|
----
|
|
|
|
=== Running the Daemon
|
|
|
|
Duplicate the existing launch configuration:
|
|
|
|
* In Eclipse select 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.
|
|
|
|
GERRIT
|
|
------
|
|
Part of link:index.html[Gerrit Code Review]
|
|
|
|
SEARCHBOX
|
|
---------
|