salesforce / rules_spring

Bazel rule for building Spring Boot apps as a deployable jar
BSD 3-Clause "New" or "Revised" License
224 stars 48 forks source link

pull through deps from the java_library #59

Closed plaird closed 3 years ago

plaird commented 3 years ago

Instead of reiterating the deps in the springboot rule, this PR allows the deps to be stated once in the java_library, and pulled through in the springboot rule. Fixes issue #31 .

PREVIOUS:

java_library(
    name = "helloworld_lib",
    srcs = glob(["src/main/java/**/*.java"]),
    resources = glob(["src/main/resources/**"]),
    deps = springboot_deps + lib_deps,
)

springboot(
    name = "helloworld",
    boot_app_class = "com.sample.SampleMain",
    java_library = ":helloworld_lib",
    deps = springboot_deps + lib_deps,
)

NEW:

java_library(
    name = "helloworld_lib",
    srcs = glob(["src/main/java/**/*.java"]),
    resources = glob(["src/main/resources/**"]),
    deps = springboot_deps + lib_deps,
)

springboot(
    name = "helloworld",
    boot_app_class = "com.sample.SampleMain",
    java_library = ":helloworld_lib",
    # NO DEPS NEED TO BE DECLARED HERE
)