Valentin Lehuger
Valentin Lehuger

Reputation: 1

Provided dependencies for _deploy.jar java_binary

I want to migrate a maven project to Bazel. In maven, I have some dependencies declared as provided. It means the dependency is used to compile but is not shipped in the final jar.

    <dependency>
        <groupId>org.apache.spark</groupId>
        <artifactId>spark-core_2.11</artifactId>
        <version>${spark.version}</version>
        <scope>provided</scope>
    </dependency>

Is there a way to declare dependencies as provided in Bazel for a java binary that are not in the _deploy.jar ?

Upvotes: 0

Views: 317

Answers (1)

Benjamin Muschko
Benjamin Muschko

Reputation: 33436

I believe you are looking for compile-only dependencies provided by rules_jvm_external.

load("@rules_jvm_external//:specs.bzl", "maven")

maven_install(
    artifacts = [
        maven.artifact("org.apache.spark", "spark-core_2.11", "<spark.version>", neverlink = True),
    ],
)

Upvotes: 1

Related Questions