这可能是一个新手问题,但我是Maven的新手。
我正在尝试构建Gerrit的复制插件"since the master branch (and thus Gerrit 2.5) no longer supports replication out of the box."
所以我在新目录中克隆了https://gerrit.googlesource.com/plugins/replication并执行了mvn clean install
。错误消息是:
[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
看起来这个网址无效:https://gerrit-api.commondatastorage.googleapis.com/release/ - 但就像我说的,我是Maven的新手,所以我不知道如何继续。我做了一些研究,但我不知道我在找什么。
任何指针都会受到高度赞赏。提前谢谢。
答案 0 :(得分:1)
有几件事 -
您缺少gerrit-plugin-api.jar。目前这不是上游提供的,因此您必须自己构建它。我相信从Gerrit存储库运行mvn install
会打包并将此jar添加到您的系统中。
您不想运行install
,只想在插件上运行package
。 mvn package
会将.jar放入目标/文件夹中,然后将其复制到Gerrit安装中的插件文件夹中。
答案 1 :(得分:1)
就像Brad提到的那样,我错过了 gerrit-plugin-api.jar 。不幸的是,我无法构建它,因为Gerrit回购似乎最近面临问题,正如其他主题(this one, for instance - 两天前所提到的那样)。
无论如何,以下是基于Brad答案的额外步骤(希望这可能有助于其他人):
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
这些步骤对我有用,以防其他人遇到同样的问题。
git clone https://gerrit.googlesource.com/gerrit
检查可用的“版本”
git branch -r
git checkout -b 2.5 origin/stable-2.5
这些步骤在我的环境中的主分支上不起作用,我正在使用2.5 ...
所以是的,2.5。
cd gerrit
mvn clean install
这将重建整个宇宙,去拿一杯咖啡。 :)
..完成后
cd gerrit-plugin-api/
mvn package
这还需要一些时间......
如果一切顺利,您可以将jar复制到目标文件夹,例如:
cp target/<large-name>.jar ~/replication.jar
最后安装它(从〜):
ssh -p 29418 localhost gerrit plugin install -n name \ - <replication.jar
有关如何安装Gerrit插件的详细信息是here。
问题是,现在我又遇到了另一个错误,例如:
“(某事)已经配置了绑定(某事物)。”
但那是另一个故事/帖子/帖子......
谢谢,祝你好运!
答案 2 :(得分:0)
在顶层进行mvn -P all clean install
,而不是在gerrit-plugin-api
内。
答案 3 :(得分:0)
最快的修复方法是更改pom.xml并使用不是快照的版本。我试图为stable-2.6分支构建delete-project并面临同样的问题。所有需要做的就是改变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>
答案 4 :(得分:0)
基于@ Conaaando的回答,我执行了这些确切的步骤并成功使用了该插件。步骤由http://asheepapart.blogspot.com/2013/12/how-to-build-gerrit-replication-plugin.html
提供git clone --recursive https://gerrit.googlesource.com/gerrit
你需要 - recursive ,因为插件实际上是git子模块,否则不会与你的repo一起克隆。
如果您已经克隆过,则可以运行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
没有必要跳过测试或生成Java Doc,但它会大大缩短编译时间并减少maven使用的内存量
cd gerrit-plugin-api
mvn package -Dmaven.javadoc.skip=true
这将创建复制插件构建所需的jar
cd plugins/replication
mvn package -Dmaven.javadoc.skip=true
此时,您已经编译并打包了复制jar!您现在需要做的就是将它注册到您的Gerrit服务器。为简单起见,我假装您的gerrit服务器正在gerrit.example.com
运行。这些步骤将复制jar复制到您的审阅服务器,然后指示审阅服务器从该复制的位置安装插件。
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