On 04/30/2015 03:59 AM, Vince Thyng wrote:
>
> I am trying to get my first plugin working in gerrit. I built it with
> buck and then put the reviewers-by-blame.jar in the plugins folder.
> When gerrit starts, the error_log reports:
>
> [2015-04-29 11:42:20,382] WARN
> com.google.gerrit.server.plugins.PluginLoader : Cannot load plugin
> reviewers-by-blame
> java.lang.NoClassDefFoundError: com/google/gerrit/common/EventListener
> at
> com.googlesource.gerrit.plugins.reviewersbyblame.ReviewersByBlameModule.configure(ReviewersByBlameModule.java:26)
>
This error is because the plugin is built against a different API
version than the version of Gerrit you're running it on.
> It looks like I am missing a dependency, but it is not clear to me how
> to add it. I found the com folder with the EventListener.class in my
> cloned gerrit folder and copied it to the plugins folder, but that did
> not work.
>
No, this will not work.
> Did I need to build the plugin differently to include the dependencies
> in the jar?
> maybe I will just open the jar and add the com folder
>
And neither will this.
I don't see any git checkout command, so that means you're using the
master branch of Gerrit.
and again here there's no git checkout, so you're also building the
master branch of the plugin.
Furthermore, since you're building in-tree it is building the plugin
against the API from Gerrit's master branch regardless of what branch of
the plugin is checked out.
To build the plugin in-tree with buck you need to make sure the correct
branches are checked out both on gerrit and the plugin itself:
cd gerrit
git checkout v2.10 # or any v2.10.x tag, or the head of stable-2.10
cd plugins/reviewers-by-blame
git checkout origin/stable-2.10
cd ../..
buck build plugins/reviewers-by-blame:reviewers-by-blame
Alternatively you can build it in standalone mode with Maven, then you
don't need to clone Gerrit at all:
cd $HOME
git clone
https://gerrit.googlesource.com/plugins/reviewers-by-blame
cd reviewers-by-blame
git checkout origin/stable-2.10
mvn clean package
the JAR file is at target/reviewersbyblame-2.10.jar
Note that there is no standalone buck build on the stable-2.10 branch;
that was only added on stable-2.11.