我想将Maven项目迁移到Bazel。在Maven中,我有一些依赖项声明为if let viewLayer = undoStack.last {
if let view = viewLayer as? UIView {
self.view.addSubview(view)
} else if let layer = viewLayer as? CALayer {
view.layer.addSublayer(layer)
}
addedViews.append(viewLayer)
undoStack.removeLast()
}
。这意味着依赖项可用于编译,但不会在最终的jar中提供。
provided
对于不在 <dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>${spark.version}</version>
<scope>provided</scope>
</dependency>
中的Java二进制文件,是否可以在Bazel中将依赖项声明为provided
?
答案 0 :(得分:1)
我相信您正在寻找compile-only dependencies提供的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),
],
)