1

Let's say I have a library such as:

scala_library(
    name = "my_favorite_scala_library",
    srcs = glob(["*.scala"]),
    exports = [
        "A",
        "B",
    ],
    deps = [
        "A",
        "B",
        "C",
        "D",
    ],
)

bazel build //path/to/my/library:my_favorite_scala_library builds a "skinny" JAR as expected and doesn't package in any dependencies or exports.

Building a _deploy.jar will package in all transitive dependencies.

Is there a simple way to have some middle ground where I can build a JAR that will package in only the main source AND any exports, either using the exports functionality or some other Bazel functionality that I may be overlooking? I'm open to both some custom invocation of a bazel build command or some field/functionality on the rule definitions that I may not be aware of.

Frank P.
  • 503
  • 5
  • 21
  • One thing which I don't want to speculate too much on in the main post, but will add as a comment here, is that I'm unsure whether `runtime_deps` from `java_library` and `scala_library` is what I'm looking for. – Frank P. Apr 04 '23 at 20:21

0 Answers0