kevingessner
kevingessner

Reputation: 18995

remotely-built `java_binary`s can't run locally

I'm using Bazel 0.29.1 with remote execution to build java_binary targets. They are straightforward targets with a few sources and deps, e.g.

java_binary(
    name = "foo",
    main_class = "my.foo",
    runtime_deps = [
        "//my/foo",
        "//third_party/jvm/org/apache/logging/log4j:log4j_core",
    ],
)

The remote execution config is using rbe_autoconfig from Bazel toolchains 0.29.8 and the default build container.

The binary builds fine with bazel --config=remote build //:foo. However, it fails when run with bazel --config=remote run //:foo:

/home/kgessner/.cache/bazel/_bazel_kgessner/[snip]/foo: line 359: /usr/lib/jvm/java-8-openjdk-amd64/bin/java: No such file or directory

The java_binary wrapper/launcher has the wrong java path: /usr/lib/jvm/java-8-openjdk-amd64/bin/java is the path to java in the build container, but not locally.

I can't find the right combination of java flags to make this work: build remotely but use the local JRE when it's run. What's the trick?

Upvotes: 0

Views: 110

Answers (1)

László
László

Reputation: 4281

Sounds like a bug. Could you please file it on GitHub?

Upvotes: 0

Related Questions