1

我们正在尝试创建一个也使用 Spark 的 Scala 项目,但我们在读取扩展文件“intellij_info_bundled.bzl”时遇到问题:没有这样的包“@intellij_aspect//”:在 C:/users// 中找不到 WORKSPACE 文件_bazel_user/i45wuf6d/external/intellij_aspect。Intellij 中是否缺少某些内容?

斯卡拉文件

包 src.main.scala

object HelloWorld extends App {
 def main(args: Array[String]) {
     println("Hello, world!")

} }

构建文件

package(default_visibility = ["//visibility:public"])

load("@io_bazel_rules_scala//scala:scala.bzl", "scala_library", "scala_test")
scala_library(
name = "hello-world",
srcs = glob(["src/main/scala/*.scala"]),
)


scala_test(
name = "Hello_test",
srcs = glob(["src/main/scala/*.scala"]),
size = "small", # Expect this test to run quickly
   )

工作空间

workspace(name = "scala_example")

rules_scala_version="7522c866450cf7810eda443e91ff44d2a2286ba1" # update this as needed

http_archive(
name = "io_bazel_rules_scala",
url = "https://github.com/bazelbuild/rules_scala/archive/%s.zip"%rules_scala_version,
type = "zip",
strip_prefix= "rules_scala-%s" % rules_scala_version
)

load("@io_bazel_rules_scala//scala:scala.bzl", "scala_repositories")
scala_repositories()`enter code here`

# register default scala toolchain
load("@io_bazel_rules_scala//scala:toolchains.bzl", "scala_register_toolchains")
scala_register_toolchains()

来自控制台的命令和错误

命令:C:\ProgramData\chocolatey\bin\bazel.exe build --tool_tag=ijwb:IDEA:community --keep_going --curses=no --color=yes --experimental_ui=no --progress_in_terminal_title=no --aspects =@intellij_aspect//:intellij_info_bundled.bzl%intellij_info_aspect --override_repository=intellij_aspect=C:\Users\ADMIN.IdeaIC2017.3\config\plugins\ijwb\aspect --output_groups=intellij-compile-java,intellij-compile-py - //...:全部

信息:加载完成。正在分析...错误:读取扩展文件“intellij_info_bundled.bzl”时遇到错误:没有这样的包“@intellij_aspect//”:在 C:/users/admin/appdata/local/temp/_bazel_sandhya/criyrv6d/ 中找不到 WORKSPACE 文件外部/intellij_aspect。信息:找到 3 个目标...警告:无法为前缀“bazel-”创建一个或多个便捷符号链接:无法创建符号链接 bazel-out -> C:/users/admin/appdata/local/temp/_bazel_sandhya/criyrv6d /execroot/scala_example/bazel-out:无法创建联结(名称=C:\users\admin\scalaprojects\example1\bazel-out,目标=C:\users\admin\appdata\local\temp_bazel_sandhya\criyrv6d\execroot\scala_example \bazel-out): 错误: src/main/native/windows/file-jni.cc(86): nativeCreateJunction(C:\users\admin\scalaprojects\example1\bazel-out, C:

无法创建符号链接 bazel-out -> C:/users/admin/appdata/local/temp/_bazel_sandhya/criyrv6d/execroot/scala_example/bazel-out: 无法创建连接 (name=C:\users\admin\scalaprojects\example1 \bazel-out, target=C:\users\admin\appdata\local\temp_bazel_sandhya\criyrv6d\execroot\scala_example\bazel-out): 错误: src/main/native/windows/file-jni.cc(86): nativeCreateJunction(C:\users\admin\scalaprojects\example1\bazel-out,C:\users\admin\appdata\local\temp_bazel_sandhya\criyrv6d\execroot\scala_example\bazel-out):错误:src/main/native/windows /file.cc(128): CreateJunction(\?\C:\users\admin\scalaprojects\example1\bazel-out): 当文件已经存在时无法创建文件。. 信息:正在构建... 错误:命令成功,但并未分析所有目标。信息:经过时间:18.108 秒,关键路径:0.05 秒

这只是一个示例 Helloworld 程序

4

1 回答 1

1

一般来说,像@Ittai一样,我建议你在intellij 插件 github repo中打开一个问题。

不幸的是,您的插件版本不再受支持。我之前也遇到过旧版本插件的问题,建议升级到最新版本。这解决了我面临的具体问题。

报告问题时,请确保包含以下信息:

  • intellij 内部版本号
  • 插件版本号
  • rules_scala 版本
  • 操作系统(似乎您使用的是 Windows,而大多数用户使用的是基于 unix 的系统)
  • bazel 版本号
  • 您如何打开 intellij 项目(BUILD 文件、WORKSPACE、.blazeproject)

此外,为了验证这实际上是插件的问题,我还建议您尝试在基于 Unix 的系统上重现此问题。看来您正在 Windows 上使用 Intellij 编译。这可能是 Windows 特定的问题,无法识别方面。

尝试复制时,请确保将存储库克隆到单独的目录中,关闭 intellij 项目,然后重新打开项目

于 2018-07-12T06:19:43.040 回答