So I'm sure someone here knows what's going on here. There is a missing piece to the puzzle that I just can't find.
Our team has developed several plugins for Gerrit. (We are using 2.8.4 and are trying to upgrade to 2.10.2 but we need to get our plugins squared away first.)
We are trying to work out the correct process for updating our plugin code, building a new jar and installing the jar on the server. But we're having major difficulties getting Gerrit to actually run new versions of whatever plugin we update.
Here's a typical scenario:
- I have a plugin, let's say it's version 2.0. Let's call it "george". It is installed and running fine in Gerrit. I have a little bit of code in this plugin that writes "2.0" out to a plugin-specific file.
- In my plugin code I make a change. Nothing changes structurally (the way the code is organized). No new classes are created and no new dependencies are added.
- I also change the "2.0" output to be "2.1".
- I recompile the plugin JAR file "george-2.1.jar".
- I remove the plugin (gerrit plugin rm george).
- I install the new version (gerrit plugin install ....../george-2.1.jar). No errors in error_log. No errors on the command line. I wait for the plugin cleanup messages in the error_log file.
- I watch my plugin's log file and I see it print out "2.0" and not the expected "2.1".
- I check the checksum of the "george-2.1.jar" file that is sitting in $GERRIT_HOME/plugins and it is the new file.
- I even unjar the file and reverse compile the class file with the "2.0"/"2.1" in it and it clearly shows "2.1".
So that's weird.
So I try this:
- I remove the plugin again.
- I remove the "george*.disabled" from $GERRIT_HOME/plugins entirely.
- I shut down Gerrit.
- I remove the $GERRIT_HOME/tmp folder entirely as well.
- I restart Gerrit.
- I install the new version fresh (gerrit plugin install ....../george-2.1.jar).
- I watch my plugin's log file and I see it print out "2.0" and not the expected "2.1".
- I check the checksum of the "george.jar" file that is sitting in $GERRIT_HOME/plugins and it is the new file.
- I even unjar the file and reverse compile the class file with the "2.0" and "2.1" in it and it clearly shows "2.1".
Okay I am now at a complete loss.
Why is Gerrit silently and smoothly taking the install but clearly running old code?
Where is Gerrit getting that old code? What other caches exist?
I've done other experiments too and it is clear that there is some kind of cache somewhere in the system that is holding on to old plugin Jars.
But I can't for the life of me find it.
On a hunch I try this:
- I go into my Java project for the "george" plugin and I refactor the package(s) so that the package names are different.
- I recompile the plugin JAR file "george-2.1.jar".
- I remove the plugin (gerrit plugin rm george).
- I install the new version (gerrit plugin install ....../george-2.1.jar). No errors in error_log. No errors on the command line. I wait for the plugin cleanup messages in the error_log file.
- I watch my plugin's log file and I see it print out "2.1"!
Can anyone help me out here?
What is going on here?
Clearly I should not have to refactor my plugin's code on every upload.
Is there a decent guide to the dependency management and caching going on with Gerrit's plugin mechanism?
Note the problem gets even more complicated and much worse when my plugin incorporates libraries from other Java projects.