Adding plugins to Gerrit

This was more painful than I expected, even knowing that it required building both the plugin and Gerrit itself from source.

Here are the steps (for Gerrit 2.7)…. deep breath!

  1. Clone Gerrit source:
    git clone
  2. Inside this clone, checkout the tag matching your running version (2.7)
    cd gerrit
    git checkout tags/v2.7
  3. Check out submodules
    git submodule update --init --recursive
  4. Build with Maven, skipping tests (takes around 5 mins on a fast laptop)
    mvn clean install -DskipTests
  5. Clone the plugin source
    git clone
  6. Roll it back to the point just before the Gerrit-ApiVersion was bumped to the next snapshot.  So, for 2.7, you want the version before this property was bumped to 2.8-SNAPSHOT.
    git checkout 4971cea
  7. Now build this with Maven:
    mvn clean package -DskipTests

In the target directory, you have the plugin, which you can rename (to remove the version tag) and install into your running Gerrit.

Tracking down a version of the plugin that matches the Gerrit API is not helped by the fact that the Gerrit plugin repositories do not seem to have branches or tags (unlike the main Gerrit repo).

I was fortunate that running:

git log --oneline --date-order

turned up the following:

2779e13 Harmonize plugin version and used gerrit plugin version
d13cc8f Bump gerrit API to 2.8-SNAPSHOT
4971cea Add support for schemas 78, and 79
a437b87 Bump used gerrit API to version 2.7-SNAPSHOT

From which I could ascertain that 4971cea was the version I probably needed – the latest version before they switched to the new API. To satisfy my own OCD, I did then find that the very obvious breaking changes in the 2.8 API occurred some while after d13cc8f, but I stand by the version I chose as being the most likely to be stable.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: