简体   繁体   中英

Error when trying to 'mvn clean install' Gerrit's replication plugin

This is probably a newbie question, but I'm new to Maven.

I'm trying to build Gerrit's replication plugin, "since the master branch (and thus Gerrit 2.5) no longer supports replication out of the box."

So I did clone https://gerrit.googlesource.com/plugins/replication and executed mvn clean install inside the new directory. The error message is:

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building replication 1.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for com.google.gerrit:gerrit-plugin-api:jar:2.6-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.840s
[INFO] Finished at: Thu Apr 25 17:30:10 BRT 2013
[INFO] Final Memory: 6M/105M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project replication: Could not resolve dependencies for project com.googlesource.gerrit.plugins.replication:replication:jar:1.1-SNAPSHOT: Failure to find com.google.gerrit:gerrit-plugin-api:jar:2.6-SNAPSHOT in https://gerrit-api.commondatastorage.googleapis.com/release/ was cached in the local repository, resolution will not be
reattempted until the update interval of gerrit-api-repository 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

It looks like this URL isn't valid: https://gerrit-api.commondatastorage.googleapis.com/release/ -- but like I said, I'm new to Maven so I'm not sure how to proceed. I did some research, but I don't know what I'm looking for.

Any pointer would be highly appreciated. Thanks in advance.

A couple of things -

  1. You are missing the gerrit-plugin-api.jar. This currently isn't provided upstream, so you must build it yourself. I believe running mvn install from a Gerrit repository will package and add this jar to your system.

  2. You don't want to run install , you just want to run package on the plugin. mvn package will put the .jar in the target/ folder, which you then copy to your plugins folder inside your Gerrit installation.

Good luck!

Like Brad mentioned, I am missing the gerrit-plugin-api.jar . Unfortunately, I was not able to build it, since the Gerrit repos seem to be facing issues lately, as mentioned in other threads ( this one, for instance - from two days ago).

Anyway, below are my additional steps based on Brad's answer (hopefully this may help others):

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

EDIT

These are the steps that worked for me, in case someone else faces the same issue.

git clone https://gerrit.googlesource.com/gerrit

Check available 'versions'

git branch -r 
git checkout -b 2.5 origin/stable-2.5

The steps didn't work on the master branch in my environment, and I'm using 2.5...
So yeah, 2.5.

cd gerrit
mvn clean install

This will rebuild the entire universe, go grab a cup of coffee. :)
.. when done

cd gerrit-plugin-api/
mvn package

This also takes some time...
If everything goes fine, you can copy the jar at the target folder, like:

cp target/<large-name>.jar ~/replication.jar

Finally install it (from ~):

ssh -p 29418 localhost gerrit plugin install -n name \ - <replication.jar

Details on how to install Gerrit plugins are here .

The thing is, now I'm getting another error, something like:

"A binding to (something) was already configured at (something)."

But that's another story / thread / post...
Thanks and good luck!

在顶层做一个mvn -P all clean install ,而不是在gerrit-plugin-api里面。

The fastest way to fix is is to change the pom.xml and use a version that is not a snapshot. I was trying to build the delete-project for the stable-2.6 branch and was facing the same issue. All that needs to be done is to change the Gerrit-ApiVersion:

     <Gerrit-ApiType>plugin</Gerrit-ApiType>
-    <Gerrit-ApiVersion>2.6-SNAPSHOT</Gerrit-ApiVersion>
+    <Gerrit-ApiVersion>2.6-rc2</Gerrit-ApiVersion>
   </properties>
   <name>Delete Project Gerrit Plugin</name>

Building off of @Conaaando's answer, I performed these exact steps and successfully am using the plugin. Steps courtesy of http://asheepapart.blogspot.com/2013/12/how-to-build-gerrit-replication-plugin.html

git clone --recursive https://gerrit.googlesource.com/gerrit

You need the --recursive here because the plugins are actually git submodules and won't otherwise be cloned along with your repo.

If you've already cloned, you can run git submodule init; git submodule update git submodule init; git submodule update

cd gerrit
git checkout -b stable-2.7 origin/stable-2.7
mvn install -DskipTests=true -Dmaven.javadoc.skip=true

It's not necessary to skip the tests or generating Java Doc, but it will greatly improve your compile time and decrease the amount of memory maven uses

cd gerrit-plugin-api
mvn package -Dmaven.javadoc.skip=true

This creates the jar that will be necessary for the replication plugin to get built

cd plugins/replication
mvn package -Dmaven.javadoc.skip=true

At this point, you have compiled and packaged the replication jar! All you need to do now is register it with your Gerrit server. For simplicity, I'll pretend your gerrit server is running at gerrit.example.com . These steps copy the replication jar to your review server and then instruct the review server to install the plugin from that copied location.

scp target/replication-2.7.jar gerrit.example.com:/tmp/
ssh -p 29418 gerrit.example.com gerrit plugin install -n replication /tmp/replication-2.7.jar

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM