Is the .runfiles folder necessary for java deploy binaries?

101 views
Skip to first unread message

mvn...@gmail.com

unread,
Jul 25, 2016, 1:57:20 AM7/25/16
to bazel-discuss
If I have a java_binary rule, and I build the "name_deploy.jar" target, and I want to deploy this jar, do I need to also copy over the .runfiles folder? I notice there's a "--singlejar" flag in the generated runner script, but looking through the code a bit, it looks like it's disabled with a "<condition> || 1 == 1": https://github.com/bazelbuild/bazel/blob/50681c1b6cca1856f5f7b401ee5c757f22aa2e54/src/main/java/com/google/devtools/build/lib/bazel/rules/java/java_stub_template.txt#L131

So, how can I build a java binary/deploy where .runfiles are not needed to run?

Damien Martin-guillerez

unread,
Jul 25, 2016, 7:22:11 AM7/25/16
to mvn...@gmail.com, bazel-discuss
Hi,

This is not necessary if you are not using artifacts provided in the data attribute of your java_* targets. If you don't have a data attribute, you can simply build //my/package:target_deploy.jar that will build a "_deploy.jar" suitable for standalone use.

On Mon, Jul 25, 2016 at 7:57 AM <mvn...@gmail.com> wrote:
If I have a java_binary rule, and I build the "name_deploy.jar" target, and I want to deploy this jar, do I need to also copy over the .runfiles folder? I notice there's a "--singlejar" flag in the generated runner script, but looking through the code a bit, it looks like it's disabled with a "<condition> || 1 == 1": https://github.com/bazelbuild/bazel/blob/50681c1b6cca1856f5f7b401ee5c757f22aa2e54/src/main/java/com/google/devtools/build/lib/bazel/rules/java/java_stub_template.txt#L131

So, how can I build a java binary/deploy where .runfiles are not needed to run?

--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/cd11b98d-83d1-46be-ab51-2e90fef66e54%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages