Bazel无法找到maven依赖

时间:2017-08-07 22:21:56

标签: maven bazel

当我使用bazel构建一个简单的玩具项目时,我收到以下错误:

$ bazel build :example-test
ERROR: /home/ubuntu/foo/scala_bazel_test/src/scala/test/src/com/foo/util/BUILD:1:1: no such package '@org_scalatest//jar': Failed to fetch Maven dependency: Could not find artifact org.scalatest:scalatest_2_11:jar:3.0.1 in org_scalatest (https://repo1.maven.org/maven2/) and referenced by '//src/scala/test/src/com/foo/util:example-test'

BUILD和WORKSPACE文件的相关部分如下: BUILD:

scala_test(
  name = "example-test",
  srcs = glob(["**/*.scala"]),
  deps = [
    "@org_scalatest//jar",
    "@junit//jar",
    "@org_hamcrest//jar",
    "//src/scala/main/src/com/foo/util:example-lib"]
)

WORKSPACE:

...
maven_jar(
  name = "org_scalatest",
  artifact = "org.scalatest:scalatest_2_11:3.0.1",
)

错误表明我已经为下载此依赖项提供了错误的名称或错误的工件,但目前尚不清楚问题是什么。我可以在浏览器中访问所请求的scalatest版本: https://repo1.maven.org/maven2/org/scalatest/scalatest_2.11/3.0.1/

1 个答案:

答案 0 :(得分:2)

你有一个拼写错误,一个下划线而不是工件名称中的句号。