Compiling plugin X for version Y.

132 views
Skip to first unread message

Joshua J. Kugler

unread,
May 20, 2013, 9:25:33 PM5/20/13
to repo-d...@googlegroups.com
So, we're running 2.5.x, and would like to compile the delete-project plugin
for our use.

Problem 1: The delete-project plugin repo has no tags or branches for
versions.
Problem 2: When I run 'mvn package' it tells me it's trying to build the 1.1-
SNAPSHOT against the Gerrit 2.7 API (which it fails to download).

How might I got about

1) finding the version that is compatible with 2.5.x
2) Pointing it to the gerrit version we just compiled locally.

So, the Gerrit 2.5 build worked, but there is nothing in gerrit/gerrit-plugin-
api. Was there supposed to be?

Going into that directory, and running 'mvn package' I get:

[ERROR] Failed to execute goal on project gerrit-plugin-api: Could not resolve
dependencies for project com.google.gerrit:gerrit-plugin-api:jar:2.5-SNAPSHOT:
The following artifacts could not be resolved: com.google.gerrit:gerrit-
sshd:jar:2.5-SNAPSHOT, com.google.gerrit:gerrit-httpd:jar:2.5-SNAPSHOT: Could
not find artifact com.google.gerrit:gerrit-sshd:jar:2.5-SNAPSHOT in gerrit-
maven (https://gerrit-maven.commondatastorage.googleapis.com) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please
read the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

Help!

Very new to compiling Java projects.

j

--
Joshua J. Kugler - Fairbanks, Alaska
Azariah Enterprises - Programming and Website Design
jos...@azariah.com - Jabber: peda...@gmail.com
PGP Key: http://pgp.mit.edu/ ID 0x73B13B6A

Pursehouse, David (Sony Mobile)

unread,
May 20, 2013, 10:01:43 PM5/20/13
to Joshua J. Kugler, repo-d...@googlegroups.com
> 1) finding the version that is compatible with 2.5.x
>

The latest head of the master branch does not build with the 2.5 API

I was able to build against 2.5 after checking out commit 73933dca30cdf1d9b18c5a26b57bed8e31c9448d which is the change before "Allow compilation against 2.6-SNAPSHOT API", so I guess the last one that support 2.5.


> 2) Pointing it to the gerrit version we just compiled locally.
>

You need to edit the plugin's pom.xml and change the API version to 2.5-SNAPSHOT


> So, the Gerrit 2.5 build worked, but there is nothing in gerrit/gerrit-plugin- api. Was there supposed to be?
>

The plugin-api is not built by default, you need to do:

$ cd gerrit-plugin-api
$ mvn clean package install

...which will put the plugin API's JAR file in your local maven repository.

If that fails with:

> The following artifacts could not be resolved: com.google.gerrit:gerrit- sshd:jar:2.5-SNAPSHOT
>

...then try building gerrit again with the "install" target

$ cd ..
$ mvn install

...and then build the plugin API again.


> Help!
> Very new to compiling Java projects.
>

To be fair, I think your troubles are more likely related to Maven being... Maven.

https://www.youtube.com/watch?v=mBmExt184vc

Joshua J. Kugler

unread,
May 21, 2013, 2:23:41 PM5/21/13
to repo-d...@googlegroups.com, Pursehouse, David (Sony Mobile)
All that worked. Thanks!

Another compiling question:

I checked out tag v2.5.4, but when I compile, it's still naming everything
with '2.5-SNAPSHOT' How do I compile a release WAR?

Thanks!

j

Shawn Pearce

unread,
May 21, 2013, 2:35:50 PM5/21/13
to Joshua J. Kugler, repo-discuss, Pursehouse, David (Sony Mobile)
On Tue, May 21, 2013 at 11:23 AM, Joshua J. Kugler <jos...@azariah.com> wrote:
> I checked out tag v2.5.4, but when I compile, it's still naming everything
> with '2.5-SNAPSHOT' How do I compile a release WAR?

./tools/release.sh

Joshua J. Kugler

unread,
May 21, 2013, 2:45:21 PM5/21/13
to repo-d...@googlegroups.com, Shawn Pearce, Pursehouse, David (Sony Mobile)
Great! Thanks!

j

David Pursehouse

unread,
Oct 29, 2013, 8:43:22 PM10/29/13
to yetanotherion, repo-d...@googlegroups.com
On 10/29/2013 11:28 PM, yetanotherion wrote:>
> [...]
>

Please send mails to the repo-discuss group, rather than directly to me.
You're likely to get a quicker response.

> To do so, I checked out the source code
> % git clone --recursive https://gerrit.googlesource.com/gerrit
> % cd gerrit
> % git checkout -b 2.6 origin/stable-2.6

When you clone the repository, it by default checks out the master
branch and the associated plugin revisions from the master branch.

When you switch to stable-2.6 with `git checkout -b 2.6
origin/stable-2.6` the submodules are not automatically updated. You
can see this from the output:

$ git checkout -b 2.6 origin/stable-2.6
warning: unable to rmdir plugins/cookbook-plugin: Directory not empty
warning: unable to rmdir plugins/download-commands: Directory not empty
M plugins/commit-message-length-validator
M plugins/replication
M plugins/reviewnotes
Branch 2.6 set up to track remote branch stable-2.6 from origin.
Switched to a new branch '2.6'

And from git status:

$ git status
# On branch 2.6
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working
directory)
#
# modified: plugins/commit-message-length-validator (new commits)
# modified: plugins/replication (new commits)
# modified: plugins/reviewnotes (new commits)
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# plugins/cookbook-plugin/
# plugins/download-commands/

To set the plugins to the correct revisions for stable-2.6 you need to
run `git submodule update`:

$ git submodule update
Submodule path 'plugins/commit-message-length-validator': checked out
'a2aaf1a0151959e69e8f578d2f60f6a608052e9a'
Submodule path 'plugins/replication': checked out
'e7b4bce71dabfe1cc2115b00791607e68d61acb8'
Submodule path 'plugins/reviewnotes': checked out
'5fd0585ece92abfb3f31b82d3e3846b33f161fff'

I don't see that mentioned in your steps listed above. Did you not do
that, or just didn't include it in the steps that you listed?

> and when building
> % mvn -U clean package
> obtained,
>
> [ERROR] Failed to execute goal on project gerrit-war: Could not resolve
> dependencies for project com.google.gerrit:gerrit-war:war:2.6: The
> following artifacts could not be resolved:
> com.googlesource.gerrit.plugins.replication:replication:jar:2.6,
> com.googlesource.gerrit.plugins.reviewnotes:reviewnotes:jar:2.6,
>
com.googlesource.gerrit.plugins.validators:commit-message-length-validator:jar:2.6:

> Could not find artifact
> com.googlesource.gerrit.plugins.replication:replication:jar:2.6 in

Assuming you've got the correct plugin revisions checked out, does it
actually build them? It should list out all the modules being built:

[...]
[INFO] replication
[INFO] reviewnotes
[INFO] commit-message-length-validator

And if it builds them, have you checked that it's building them with
revision 2.6 and placing them in your local maven repository?

Have you tried with `install` rather than `package` on the mvn command?

I don't have a working Maven environment any more (we've moved to
building with buck on the master branch) so I can't run the build and
check what it's doing right now.


> The plugins do not seem to build in 2.6. So my questions are the following:
> a) could we develop such a plugin in 2.6 ?
> b) if not, in which version should we develop it, hoping that it would
> be compatible with gerrit 2.6 (our prod instance runs on 2.6).
>

If you want to run plugins on 2.6 you'll have to develop against the 2.6
API.


yetanotherion

unread,
Oct 30, 2013, 12:55:31 PM10/30/13
to repo-d...@googlegroups.com
Hello to all, sorry David I used gmail habits to answer to your mail directly, I'll now try the post buton.
So I tried
% cd gerrit
% git checkout -b 2.6 origin/stable-2.6
% git submodule update
% mvn -U clean update
fails
% mvn -U install too

[ERROR] /home/ialberdx/gerrit/gerrit/gerrit-plugin-api/target/unpack_sources/org/apache/velocity/anakia/NodeList.java:36: package org.jdom does not exist
[ERROR] import org.jdom.Element;
When I try to build a plugin specifically I get
~/gerrit/gerrit/plugins/replication ((v2.6))# mvn -U package
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building replication 2.6
[INFO] ------------------------------------------------------------------------
Oct 30, 2013 5:53:53 PM org.apache.commons.httpclient.HttpMethodBase readResponseBody
INFO: Response content length is not known
Oct 30, 2013 5:55:23 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
INFO: I/O exception (java.net.ConnectException) caught when processing request: Connection timed out
Oct 30, 2013 5:55:23 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry

Indeed when I try to download
from my browser I get 
404 Not Found.

Do you think setting up the build system in buck for 2.6 would be worth it ?
Best regards

Xav

unread,
Oct 31, 2013, 12:44:19 PM10/31/13
to repo-d...@googlegroups.com
I don't know which url is defined in your pom file for google repo, but I had to change them to reach a successful compilation.

These are the values I've used  depending on release / SNAPSHOT API version you want to use

Hope it helps

Xavier

yetanotherion

unread,
Nov 5, 2013, 9:55:43 AM11/5/13
to repo-d...@googlegroups.com
As an update, the commands previously depicted do not work with Maven.
However, I tried to use buck. I don't know whether it's the only working method
but
% cd gerrit
% buck build plugins/cookbook-plugin
works right away

I tried with 2.6 plugins too
% cd plugins
% buck build plugins/helloworld
vworks too (btw no need to change the (SNAPSHOT, release, ...) in the pom.xml, and it works by changing it too).

I tried to deploy the compiled helloworld scripts in a 2.6 gerrit instance, and it worked (both master and mirror).
From my personal experience, maven seems to have suspicious bugs, like being unable to setup both a http and an https proxy.
A colleague showed me a workaround that consisted at:
a) setting an http proxy in ~/.m2/settings.xml and 
b) calling mvn with -D https.proxyHost -D https.proxyPort as command line arguments.

So, going to buck is a decision I quite understand now :)



On Tuesday, May 21, 2013 3:25:33 AM UTC+2, Joshua Kugler wrote:
Reply all
Reply to author
Forward
0 new messages