blob: 468e76751df5fb64fe179ec67304d8552c5bca73 [file] [log] [blame]
Deniz Türkoglueb78b602012-05-07 14:02:36 -07001Gerrit Code Review - Plugin Development
2=======================================
3
4A plugin in gerrit is tightly coupled code that runs in the same
5JVM as gerrit. It has full access to all gerrit internals. Plugins
6are coupled to a specific major.minor gerrit version.
7
Nasser Grainawie033b262012-05-09 17:54:21 -07008Requirements
Deniz Türkoglueb78b602012-05-07 14:02:36 -07009------------
10
Nasser Grainawie033b262012-05-09 17:54:21 -070011To start development, download the sample maven project, which downloads the
12following dependencies:
Deniz Türkoglueb78b602012-05-07 14:02:36 -070013
Nasser Grainawie033b262012-05-09 17:54:21 -070014* gerrit-sdk.jar file that matches the war file to develop against
Deniz Türkoglueb78b602012-05-07 14:02:36 -070015
16
17Manifest
18--------
19
Nasser Grainawie033b262012-05-09 17:54:21 -070020Plugins need to include the following data in the jar manifest file:
21
22 Gerrit-Module = pkg.class
23
24Optionally include:
25
26 Gerrit-ReloadMode = 'reload' (default) or 'restart'
27
28If the plugin holds an exclusive resource that must be released before loading
29the plugin again, ReloadMode must be set to 'restart'. Otherwise 'reload' is
30sufficient.
Deniz Türkoglueb78b602012-05-07 14:02:36 -070031
32SSH Commands
33------------
34
Nasser Grainawie033b262012-05-09 17:54:21 -070035Plugins may provide commands that can be accessed through the SSH interface.
36These commands register themselves as a part of link:cmd-index.html[SSH Commands].
Deniz Türkoglueb78b602012-05-07 14:02:36 -070037
Nasser Grainawie033b262012-05-09 17:54:21 -070038Each of the plugin commands needs to extend SshCommand.
Deniz Türkoglueb78b602012-05-07 14:02:36 -070039
Nasser Grainawie033b262012-05-09 17:54:21 -070040Any plugin which implements at least one ssh command needs to also provide a
41class which extends the PluginCommandModule in order to register the ssh
42command(s) in its configure method which must be overriden.
Deniz Türkoglueb78b602012-05-07 14:02:36 -070043
Nasser Grainawie033b262012-05-09 17:54:21 -070044Registering is done by calling:
45
46 command(String commandName).to(ClassName<? extends SshCommand> klass)
47
48Documentation
49-------------
50
51Place files into Documentation/ or static/ and package them into the plugin jar
52to access them in a browser via <canonicalWebURL>/plugins/<pluginName>/...
53
54Deployment
55----------
56
57Deploy plugins into <review_site>/plugins/. The file name in that directory will
58be the plugin name on the server.
Deniz Türkoglueb78b602012-05-07 14:02:36 -070059
60GERRIT
61------
62Part of link:index.html[Gerrit Code Review]