简体   繁体   English

Bazel无法找到Maven依赖项

[英]Bazel cannot find maven dependency

I receive the following error when I build a simple toy project using 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'

The relevant portion of the BUILD and WORKSPACE files are the following: BUILD: 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",
)

The error suggests I have given either the wrong name or wrong artifact for downloading this dependency, but it's not clear what the issue is. 该错误表明我为下载此依赖项输入了错误的名称或错误的工件,但尚不清楚问题出在哪里。 I can access the requested version of scalatest in my browser at: https://repo1.maven.org/maven2/org/scalatest/scalatest_2.11/3.0.1/ 我可以在以下浏览器中访问所要求的scalatest版本: https ://repo1.maven.org/maven2/org/scalatest/scalatest_2.11/3.0.1/

您在工件名称中有一个错字,一个下划线而不是一个句点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM