Skip to content
This repository was archived by the owner on Sep 3, 2024. It is now read-only.

Latest commit

 

History

History
32 lines (19 loc) · 1005 Bytes

File metadata and controls

32 lines (19 loc) · 1005 Bytes

Case 2: Hello, Java!

About the case

This case uses the native java_binary and java_library rules. The java_library rule compiles and links sources into a .jar file The java_binary rule builds a jar file, plus a wrapper shell script. See bazel-bin/workshop/case2/hello.runfiles/_main/workshop/case2/hello for the wrapper script.

Additional things to try out

Updating maven dependencies

Maven dependencies are resolved using the WORKSPACE file and the maven_install.json file. Update the WORKSPACE.bazel file with new versions and run bazel run @maven//:pin to update the maven_install.json file.

Query Bazel for the dependency graph of the hello target:

bazel query "deps(//workshop/case2:hello)"

graph

vs

bazel query "deps('//workshop/case2:hello') intersect //..."

graph

Show files generated by a target:

bazel cquery //workshop/case2:hello --output=files

Create another library and consume it in the hello target