V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
flyfowl
V2EX  ›  程序员

求一个 events-log.jar 插件用于 Jenkins 与 Gerrit“通信“

  •  
  •   flyfowl · 2017-09-08 15:34:44 +08:00 · 4577 次点击
    这是一个创建于 2643 天前的主题,其中的信息可能已经有所发展或是发生改变。

    最近在搭建 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 条附言  ·  2018-03-09 15:10:56 +08:00
    3 条回复    2018-06-08 16:02:09 +08:00
    flyfowl
        1
    flyfowl  
    OP
       2017-09-08 15:57:09 +08:00
    终于 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 ”
    guan123
        2
    guan123  
       2017-09-29 13:34:15 +08:00
    感谢,实测有用,这个东西的确太难编译了
    lgh
        3
    lgh  
       2018-06-08 16:02:09 +08:00   ❤️ 1
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1190 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 21ms · UTC 23:05 · PVG 07:05 · LAX 15:05 · JFK 18:05
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.