| Gerrit Code Review - Plugin Development |
| ======================================= |
| |
| A plugin in gerrit is tightly coupled code that runs in the same |
| JVM as gerrit. It has full access to all gerrit internals. Plugins |
| are coupled to a specific major.minor gerrit version. |
| |
| Requirements |
| ------------ |
| |
| To start development, download the sample maven project, which downloads the |
| following dependencies: |
| |
| * gerrit-sdk.jar file that matches the war file to develop against |
| |
| |
| Manifest |
| -------- |
| |
| Plugins need to include the following data in the jar manifest file: |
| |
| Gerrit-Module = pkg.class |
| |
| Optionally include: |
| |
| Gerrit-ReloadMode = 'reload' (default) or 'restart' |
| |
| If the plugin holds an exclusive resource that must be released before loading |
| the plugin again, ReloadMode must be set to 'restart'. Otherwise 'reload' is |
| sufficient. |
| |
| SSH Commands |
| ------------ |
| |
| Plugins may provide commands that can be accessed through the SSH interface. |
| These commands register themselves as a part of link:cmd-index.html[SSH Commands]. |
| |
| Each of the plugin commands needs to extend SshCommand. |
| |
| Any plugin which implements at least one ssh command needs to also provide a |
| class which extends the PluginCommandModule in order to register the ssh |
| command(s) in its configure method which must be overriden. |
| |
| Registering is done by calling: |
| |
| command(String commandName).to(ClassName<? extends SshCommand> klass) |
| |
| Documentation |
| ------------- |
| |
| Place files into Documentation/ or static/ and package them into the plugin jar |
| to access them in a browser via <canonicalWebURL>/plugins/<pluginName>/... |
| |
| Deployment |
| ---------- |
| |
| Deploy plugins into <review_site>/plugins/. The file name in that directory will |
| be the plugin name on the server. |
| |
| GERRIT |
| ------ |
| Part of link:index.html[Gerrit Code Review] |