Re: how to install gerrit plugin

13,008 views
Skip to first unread message

Shawn Pearce

unread,
Apr 2, 2013, 5:14:30 PM4/2/13
to Bill McCormick, repo-discuss
On Tue, Apr 2, 2013 at 9:11 AM, Bill McCormick <wpmcc...@gmail.com> wrote:
> I'm trying to install a gerrit plugin, but I'm not sure how to start.
>
> I've pulled down the project, and so I now have a number of java files, and
> I'm pretty sure I need to compile into a jar, but I can't find instructions
> or a readme to walk me through it.

Usually you build the plugin by saying `mvn clean package` and then
find the plugin inside of the target directory. You can install that
JAR into gerrit using plugin install[1].

[1] https://gerrit-review.googlesource.com/Documentation/cmd-plugin-install.html

Pursehouse, David (Sony Mobile)

unread,
Apr 5, 2013, 12:49:24 AM4/5/13
to Bill McCormick, repo-d...@googlegroups.com

You need to build the plugin-api jar file.

 

Clone the Gerrit git and then:

 

$ cd gerrit-plugin-api/

$ mvn clean install

 

 

From: repo-d...@googlegroups.com [mailto:repo-d...@googlegroups.com] On Behalf Of Bill McCormick
Sent: Friday, April 05, 2013 7:41 AM
To: repo-d...@googlegroups.com
Cc: Bill McCormick
Subject: Re: how to install gerrit plugin


So I installed maven2 and ran mvn clean package ... output below. This is all new to me, so I'm not sure how/from where to "Try downloading the file manually from the project website." There appears to be nothing relevant at http://code.google.com/p/gerrit/downloads/list. Any hand-holding help appreciated. Thanks!!

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Delete Project Gerrit Plugin
[INFO]    task-segment: [clean, package]
[INFO] ------------------------------------------------------------------------
[INFO] [clean:clean {execution: default-clean}]
[INFO] Deleting file set: /home/bill/delete-project/target (included: [**], excluded: [])
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
Downloading: https://gerrit-api.commondatastorage.googleapis.com/release//com/google/gerrit/gerrit-plugin-api/2.7-SNAPSHOT/gerrit-plugin-api-2.7-SNAPSHOT.pom
[INFO] Unable to find resource 'com.google.gerrit:gerrit-plugin-api:pom:2.7-SNAPSHOT' in repository gerrit-api-repository (https://gerrit-api.commondatastorage.googleapis.com/release/)
Downloading: https://gerrit-api.commondatastorage.googleapis.com/release//com/google/gerrit/gerrit-plugin-api/2.7-SNAPSHOT/gerrit-plugin-api-2.7-SNAPSHOT.jar
[INFO] Unable to find resource 'com.google.gerrit:gerrit-plugin-api:jar:2.7-SNAPSHOT' in repository gerrit-api-repository (https://gerrit-api.commondatastorage.googleapis.com/release/)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Missing:
----------
1) com.google.gerrit:gerrit-plugin-api:jar:2.7-SNAPSHOT

  Try downloading the file manually from the project website.

  Then, install it using the command:
      mvn install:install-file -DgroupId=com.google.gerrit -DartifactId=gerrit-plugin-api -Dversion=2.7-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file there:
      mvn deploy:deploy-file -DgroupId=com.google.gerrit -DartifactId=gerrit-plugin-api -Dversion=2.7-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

  Path to dependency:
        1) com.google.gerrit.plugins:delete-project:jar:1.1-SNAPSHOT
        2) com.google.gerrit:gerrit-plugin-api:jar:2.7-SNAPSHOT

----------
1 required artifact is missing.

for artifact:
  com.google.gerrit.plugins:delete-project:jar:1.1-SNAPSHOT

from the specified remote repositories:
  gerrit-api-repository (https://gerrit-api.commondatastorage.googleapis.com/release/),
  central (http://repo1.maven.org/maven2)



[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3 seconds
[INFO] Finished at: Thu Apr 04 17:32:42 CDT 2013
[INFO] Final Memory: 14M/105M
[INFO] ------------------------------------------------------------------------

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en
 
---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Steffen Gebert

unread,
Apr 26, 2013, 10:17:42 AM4/26/13
to repo-discuss@googlegroups.com Discussion
Hi Fernando,

I ran into the same problem today..

It looks to work for me with `mvn clean install -P all`. Then gerrit-plugin-api/target/ contains the .jar file, which you can copy into your plugin.

At least it worked for me with the 2.6 stable brunch. mvn is currently running for master, I hope this also works there.

(is there a quicker way to build gerrit-plugin-api*.jar than build the hole world?)

Yours
Steffen

On Apr 26, 2013, at 4:00 PM, Fernando Fernandes <mfernande...@gmail.com> wrote:

> That didn't work for me.
>
> • git clone https://gerrit.googlesource.com/gerrit
> • cd gerrit/gerrit-plugin-api/
> • mvn clean install
> [INFO] Scanning for projects...
> [INFO]
> [INFO] ------------------------------------------------------------------------
> [INFO] Building Gerrit Code Review - Plugin API 2.7-SNAPSHOT
> [INFO] ------------------------------------------------------------------------
> [WARNING] The POM for com.google.gerrit:gerrit-sshd:jar:2.7-SNAPSHOT is missing, no dependency information available
> [WARNING] The POM for com.google.gerrit:gerrit-httpd:jar:2.7-SNAPSHOT is missing, no dependency information available
> [WARNING] The POM for com.google.gerrit:gerrit-pgm:jar:2.7-SNAPSHOT is missing, no dependency information available
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 1.342s
> [INFO] Finished at: Fri Apr 26 10:52:54 BRT 2013
> [INFO] Final Memory: 5M/105M
> [INFO] ------------------------------------------------------------------------
> [ERROR] Failed to execute goal on project gerrit-plugin-api: Could not resolve dependencies for project com.google.gerrit:gerrit-plugin-api:jar:2.7-SNAPSHOT: The following artifacts could not be resolved: com.google.gerrit:gerrit-sshd:jar:2.7-SNAPSHOT, com.google.gerrit:gerrit-httpd:jar:2.7-SNAPSHOT, com.google.gerrit:gerrit-pgm:jar:2.7-SNAPSHOT: Failure to find com.google.gerrit:gerrit-sshd:jar:2.7-SNAPSHOT in https://gerrit-maven.commondatastorage.googleapis.com was cached in the local repository, resolution will not be reattempted until the update interval of gerrit-maven has elapsed or updates are forced -> [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
>
> Please let me know if you have an idea on what's going on.
>
> Thanks,
> - Fernando

Blewitt, Alex [Tech]

unread,
Apr 26, 2013, 10:45:07 AM4/26/13
to Steffen Gebert, repo-discuss@googlegroups.com Discussion
The problem is that the gerrit-plugin-api requires certain subsets of the build to be built before it can be built, which in turn need other parts. So you probably end up needing to build about a third of the world anyway.

If you just want the API JAR then you can try running with -DskipTests=true as well; that way, it doesn't run the tests which can take some time. You can also comment out part of the modules from the parent pom that you don't need, such as the -war.

Once Gerrit 2.6 is published, hopefully the JARs will make their way to Maven central (and/or the Gerrit repository) so that you don't need to explicitly build it yourself.

Alex

-----Original Message-----
From: repo-d...@googlegroups.com [mailto:repo-d...@googlegroups.com] On Behalf Of Steffen Gebert
Sent: 26 April 2013 15:18
To: repo-d...@googlegroups.com Discussion
Subject: Re: how to install gerrit plugin

Hi Fernando,

I ran into the same problem today..

It looks to work for me with `mvn clean install -P all`. Then gerrit-plugin-api/target/ contains the .jar file, which you can copy into your plugin.

At least it worked for me with the 2.6 stable brunch. mvn is currently running for master, I hope this also works there.

(is there a quicker way to build gerrit-plugin-api*.jar than build the hole world?)

Yours
Steffen

On Apr 26, 2013, at 4:00 PM, Fernando Fernandes <mfernande...@gmail.com> wrote:

> That didn't work for me.
>
> * git clone https://gerrit.googlesource.com/gerrit
> * cd gerrit/gerrit-plugin-api/
> * mvn clean install

Fernando Fernandes

unread,
Apr 26, 2013, 12:22:37 PM4/26/13
to repo-d...@googlegroups.com
Hi! I'm on the master branch. I'll checkout 2.6 and try to use the command you suggested. Thanks!

Steffen Gebert

unread,
Apr 26, 2013, 12:41:24 PM4/26/13
to repo-d...@googlegroups.com
Try the command on the top level, not inside gerrit-plugin-api.



Fernando Fernandes <mfernande...@gmail.com> schrieb:

--
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.

Chad Horohoe

unread,
Apr 26, 2013, 12:48:52 PM4/26/13
to Steffen Gebert, Repo and Gerrit Discussion
To make sure everything's installed, I usually do the following (from
the top level):

`mvn -P all clean install`

Otherwise, I have to mvn install from top level and gerrit-plugin-api.

-Chad

Fernando Fernandes

unread,
Apr 26, 2013, 12:51:15 PM4/26/13
to repo-d...@googlegroups.com
Ok, running on the top level... It's re-building the universe. :) No errors so far. I'm on the 2.6 branch. Thanks.

Bertram Karch

unread,
Aug 6, 2013, 8:21:14 AM8/6/13
to repo-d...@googlegroups.com

Hi,

I tried to build gerrit 2.6 and 2.7 but I get the dependencies to gs-maven-wagon 3.3
downloaded source and tried to build gs-maven-wagon, but this needs  maven-wagon-bootstrap 3.3.

Where can I find maven-wagon-bootstrap ?

Bertram

mhigh...@singlehop.com

unread,
Aug 6, 2013, 1:32:43 PM8/6/13
to repo-d...@googlegroups.com
I'm compiling right now. I had to:
  1. Install latest Mavin outside of the package manager using crappy CentoOS
  2. Install full java not just JRE
  3. clone gerrit
  4. switch to 2.6 branch
  5. Do a git submodule on some plugins within that branch
  6. and so far everything is compiling

Ian Bull

unread,
Oct 29, 2013, 4:28:55 PM10/29/13
to repo-d...@googlegroups.com, Bill McCormick
Just an update. Since May 2013 (commit dcee5721) the po.xml in the gerrit-plugin-api was removed. The plugin-api jar is now built using buck. This took me a little while to find (because the example plugins themselves still use maven to build). There is some good docs in:

Documentation/dev-buck.txt 

In particular:

To build the extension and plugin API JAR files:

----
  buck build api
----

The output JAR files will be placed in:

----
  buck-out/gen/{extension,plugin}-api.jar
----

Install {extension,plugin}-api to the local maven repository:

----
  buck build api_install
----

cheers,
Ian
Reply all
Reply to author
Forward
0 new messages