最近在搭建 Jenkins+Gerrit+Git,Gerrit+Git 已经配置好了,设置 Jenkins 添加 Gerrit 服务器时,需要在 Gerrit 上添加一个名叫 events-log.jar 的插件,这个插件不是标配的,需要自行编译,我在网上找了好久都没找到现成的,尝试编译了一天多各种错误,没接触过 buck、bazel 之类的命令,好不容易编译出 buck,再用 buck build 插件各种出错,event-log 各个版本也不太一样……
有童鞋能帮忙发一个这个插件,或者帮忙编译一个吗,如果你对这类命令很熟悉的话,Gerrit 用的是 2.14.3
附一个对编译可能有帮助的链接: https://stackoverflow.com/questions/31116188/buck-build-failing-for-events-logs-gerrit-plugin-jar
1
flyfowl OP 终于 TMD 编译出来了,记录一下,方便后人:)
按照如下顺序操作,一定要按顺序: git clone https://gerrit.googlesource.com/plugins/events-log cd events-log git checkout stable-2.12 git clone https://gerrit.googlesource.com/bucklets ~/buck/bin/buck build plugin 这样就好了,bucklets 要在 events-log 目录下,建立软链接 build 会报错: BUILD FAILED: Target //bucklets/tools:download_file contains input files under a path which contains a symbolic link ({bucklets=/home/gerrit2/gerrit_src/bucklets}). To resolve this, use separate rules and declare dependencies instead of using symbolic links. If the symlink points to a read-only filesystem, you can specify it in the project.read_only_paths .buckconfig setting. Buck will assume files under that path will never change. This error happened while trying to get dependency '//bucklets/tools:download_file' of target '//lib:gson__download_bin' 删掉软链接也会报错: BUILD FAILED: Buck wasn't able to parse /home/gerrit2/gerrit_src/events-log/BUCK: IOError: [Errno 2] No such file or directory: '/home/gerrit2/gerrit_src/events-log/bucklets/gerrit_plugin.bucklet' Call stack: File "/root/buck/python-dsl/buck_parser/buck.py", line 1188, in process_with_diagnostics diagnostics=diagnostics) File "/root/buck/python-dsl/buck_parser/buck.py", line 1079, in process os.path.join(self._project_root, path)) File "/root/buck/python-dsl/buck_parser/buck.py", line 1073, in _process_build_file return self._process(build_env, path, is_implicit_include=False) File "/root/buck/python-dsl/buck_parser/buck.py", line 1033, in _process exec(code, module.__dict__) File "/home/gerrit2/gerrit_src/events-log/BUCK", line 1 include_defs('//bucklets/gerrit_plugin.bucklet') File "/root/buck/python-dsl/buck_parser/buck.py", line 807, in _include_defs inner_env, mod = self._process_include(path, is_implicit_include) File "/root/buck/python-dsl/buck_parser/buck.py", line 1047, in _process_include return self._process(build_env, path, is_implicit_include=is_implicit_include) File "/root/buck/python-dsl/buck_parser/buck.py", line 1022, in _process with open(path, 'r') as f: TMD 最后我把 bucklets 目录放到 events-log 目录下,完美编译出来了 如果报错: BUILD FAILED: //:events-log__plugin failed: javac -source 7 -target 7 -sourcepath -g -proc:none -d /home/gerrit2/gerrit_src/events-log/buck-out/bin/lib__events-log__plugin__classes -classpath /home/gerrit2/gerrit_src/events-log/buck-out/gen/lib/__gson__/gson-2.3.1.jar:/home/gerrit2/gerrit_src/events-log/buck-out/gen/lib/commons/__dbcp__/commons-dbcp-1.4.jar:/home/gerrit2/gerrit_src/events-log/buck-out/gen/lib/commons/__pool__/commons-pool-1.5.5.jar:/home/gerrit2/gerrit_src/events-log/buck-out/gen/lib/gerrit/__plugin-api__/gerrit-plugin-api-2.12.jar @buck-out/gen/__events-log__plugin__srcs No system compiler found. Did you install the JRE instead of the JDK? 那么重新设置一下 java 编译器 使用命令“ update-alternatives --config java ” |
2
guan123 2017-09-29 13:34:15 +08:00
感谢,实测有用,这个东西的确太难编译了
|
3
lgh 2018-06-08 16:02:09 +08:00 1
|