Java 如何在gerrit中安装delete-project插件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21254291/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 07:40:54  来源:igfitidea点击:

How to install delete-project plugin in gerrit?

javapythonbuildgerrit

提问by Virtual

I want to install delete-project plugin to my gerrit server. As per the latest version, I should clone it from google source and use buck build.

我想在我的 gerrit 服务器上安装 delete-project 插件。根据最新版本,我应该从 google 源代码克隆它并使用 buck build。

I cloned it and my buck is also ready.

我克隆了它,我的钱也准备好了。

What are the steps to be followed to build the delete project plugin and add it to my gerrit server.

构建删除项目插件并将其添加到我的 gerrit 服务器需要遵循哪些步骤。

I tried

我试过

buck build .

in the cloned source of delete-project. But, I am getting the following error

在删除项目的克隆源中。但是,我收到以下错误

Traceback (most recent call last):
  File "/home/gerrit/buck/src/com/facebook/buck/parser/buck.py", line 872, in <module>
    main()
  File "/home/gerrit/buck/src/com/facebook/buck/parser/buck.py", line 867, in main
    buildFileProcessor.process(build_file.rstrip())
  File "/home/gerrit/buck/src/com/facebook/buck/parser/buck.py", line 800, in process
    build_env['BUILD_FILE_SYMBOL_TABLE'])
  File "/home/gerrit/delete-project/././BUCK", line 1, in <module>
    gerrit_plugin(
NameError: name 'gerrit_plugin' is not defined
BUILD FAILED: Parse error for BUCK file ././BUCK: End of input at line 1 column 1

Please help

请帮忙

采纳答案by David Cheung

I managed to install delete-project plugin after following this thread:

在遵循此线程后,我设法安装了删除项目插件:

https://groups.google.com/forum/#!topic/repo-discuss/hbBc2TUhl7s

https://groups.google.com/forum/#!topic/repo-discuss/hbBc2TUhl7s

and then install according to:

然后按照以下方式安装:

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

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

P.S. I build the jar following the below steps:

PS我按照以下步骤构建jar:

  1. git clone --recursive https://gerrit.googlesource.com/gerrit
  2. cd gerrit
  3. git clone --recursive https://gerrit.googlesource.com/plugins/delete-project
  4. buck build delete-project:delete-project
  1. git clone --recursive https://gerrit.googlesource.com/gerrit
  2. cd gerrit
  3. git clone --recursive https://gerrit.googlesource.com/plugins/delete-project
  4. 降压构建删除项目:删除项目

You should then find the delete-project.jar in buck-out/gen/delete-project/delete-project.jar

然后您应该在 buck-out/gen/delete-project/delete-project.jar 中找到 delete-project.jar

回答by Miguel A. Baldi H?rlle

I managed to successfully build delete-project plugin with a slight modification on @DavidCheung answer:

我设法通过对@DavidCheung 答案稍加修改成功构建了删除项目插件:

  1. git clone https://gerrit.googlesource.com/gerrit
  2. cd gerrit/plugins
  3. git clone https://gerrit.googlesource.com/plugins/delete-project
  4. buck build delete-project:delete-project
  1. git 克隆https://gerrit.googlesource.com/gerrit
  2. cd gerrit/插件
  3. git 克隆https://gerrit.googlesource.com/plugins/delete-project
  4. 降压构建删除项目:删除项目

You should then find the delete-project.jar in ../buck-out/gen/delete-project/delete-project.jar

然后您应该在 ../buck-out/gen/delete-project/delete-project.jar 中找到 delete-project.jar

回答by gareth_bowles

I struggled with the answers above, maybe due to having a new version of Gerrit (2.11.2). The steps in this documentall worked for me, with one addition - you need to add the --recursive flag when you clone the Gerrit source code so that it includes the source for the standard plugins:

我在上面的答案中挣扎,可能是因为有了新版本的 Gerrit (2.11.2)。本文档中的步骤都对我有用,还有一个补充 - 您需要在克隆 Gerrit 源代码时添加 --recursive 标志,以便它包含标准插件的源代码:

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

Also, make sure to check out the correct Git branch for your Gerrit version,e.g.

另外,请确保为您的 Gerrit 版本检查正确的 Git 分支,例如

git fetch origin stable-2.11:stable-2.11
git checkout stable-2.11

回答by fracz

  1. Download the delete-project.jarfrom the build that matches your Gerrit version on https://gerrit-ci.gerritforge.com
  2. Copy it to gerrit/pluginsdirectory.
  3. Restart Gerrit.
  1. delete-project.jarhttps://gerrit-ci.gerritforge.com上与您的 Gerrit 版本匹配的构建中下载
  2. 复制到gerrit/plugins目录。
  3. 重新启动 Gerrit。