巴塞尔斯卡拉 "failed: Worker process did not return a WorkResponse"
Bazel Scala "failed: Worker process did not return a WorkResponse"
我是 Bazel 的初学者,我需要从 sbt
迁移。我使用 Scala Rules 构建我的应用程序。
我使用以下依赖项和以下别名(以防止拼写错误):
Alias
Group
Artifact
Version
borer_core
io.bullet
borer-core_2.12
1.6.3
borer_derivation
io.bullet
borer-derivation_2.12
1.6.3
scala_logging
com.typesafe.scala-logging
scala-logging_2.12
3.9.2
logback
ch.qos.logback
logback-classic
1.2.3
tagging
com.softwaremill.common
tagging_2.12
2.2.1
ujson
com.lihaoyi
ujson_2.12
1.2.2
所有这些依赖项将由 JVM External Rules 安装。在 Workspace
:
中看起来是这样
dp_deps = [
borer_core,
borer_derivation,
scala_logging,
logback,
tagging,
ujson,
]
maven_install(
name = "maven",
artifacts = dp_deps,
repositories = ["http://repo1.maven.org/maven/"],
fetch_sources = True
)
然后我尝试在我的 BUILD
文件中用 scala_library 构建一个 jar
。看起来是这样的:
scala_library(
name = "some_lib",
srcs = glob(["some_lib/src/main/**/*.scala"]),
unused_dependency_checker_mode = 'warn',
deps = [
"@maven//:io_bullet_borer_core_2_12",
"@maven//:io_bullet_borer_derivation_2_12",
"@maven//:com_typesafe_scala_logging_scala_logging_2_12",
"@maven//:ch_qos_logback_logback_classic",
"@maven//:com_softwaremill_common_tagging_2_12",
"@maven//:com_lihaoyi_ujson_2_12"
]
)
然后我尝试使用以下命令构建它:
bazel build //test-dir:some_lib --verbose_failures
我收到以下日志错误:
错误:
ERROR: /Users/<edited>/test-dir/BUILD.bazel:136:14: scala //test-dir:some_lib failed: Worker process did not return a WorkResponse:
日志:
---8<---8<--- Start of log snippet, file at /private/var/tmp/_bazel_<edited>/07059176926c1842b8d4e633b0ddf1f4/bazel-workers/worker-7-Scalac.log ---8<---8<---
[... truncated ...]
scala.tools.nsc.typechecker.Macros$MacroExpander.expand(Macros.scala:622)
at scala.tools.nsc.typechecker.Macros$MacroExpander.apply(Macros.scala:609)
at scala.tools.nsc.typechecker.Macros.standardMacroExpand(Macros.scala:784)
at scala.tools.nsc.typechecker.Macros.standardMacroExpand$(Macros.scala:782)
at scala.tools.nsc.Global$$anon.standardMacroExpand(Global.scala:480)
at scala.tools.nsc.typechecker.AnalyzerPlugins$$anon.default(AnalyzerPlugins.scala:457)
at scala.tools.nsc.typechecker.AnalyzerPlugins$$anon.default(AnalyzerPlugins.scala:454)
at scala.tools.nsc.typechecker.AnalyzerPlugins.invoke(AnalyzerPlugins.scala:411)
at scala.tools.nsc.typechecker.AnalyzerPlugins.pluginsMacroExpand(AnalyzerPlugins.scala:454)
at scala.tools.nsc.typechecker.AnalyzerPlugins.pluginsMacroExpand$(AnalyzerPlugins.scala:454)
at scala.tools.nsc.Global$$anon.pluginsMacroExpand(Global.scala:480)
at scala.tools.nsc.typechecker.Macros.macroExpand(Macros.scala:773)
at scala.tools.nsc.typechecker.Macros.macroExpand$(Macros.scala:766)
at scala.tools.nsc.Global$$anon.macroExpand(Global.scala:480)
at scala.tools.nsc.typechecker.Typers$Typer.vanillaAdapt(Typers.scala:1164)
at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1227)
at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1200)
at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1220)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5747)
at scala.tools.nsc.typechecker.Typers$Typer.typedValDefImpl(Typers.scala:5949)
at scala.tools.nsc.typechecker.Typers$Typer.typedValDef(Typers.scala:2056)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5651)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5733)
at scala.tools.nsc.typechecker.Typers$Typer.typedStat(Typers.scala:5797)
at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedStats(Typers.scala:3357)
at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3357)
at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:2017)
at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef(Typers.scala:1883)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5654)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5733)
at scala.tools.nsc.typechecker.Typers$Typer.typedStat(Typers.scala:5797)
at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedStats(Typers.scala:3357)
at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3357)
at scala.tools.nsc.typechecker.Typers$Typer.typedPackageDef(Typers.scala:5363)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5656)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5733)
at scala.tools.nsc.typechecker.Analyzer$typerFactory$TyperPhase.apply(Analyzer.scala:115)
at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:451)
at scala.tools.nsc.typechecker.Analyzer$typerFactory$TyperPhase.run(Analyzer.scala:104)
at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1501)
at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1485)
at scala.tools.nsc.Global$Run.compileSources(Global.scala:1478)
at scala.tools.nsc.Global$Run.compile(Global.scala:1604)
at scala.tools.nsc.Driver.doCompile(Driver.scala:47)
at scala.tools.nsc.MainClass.doCompile(Main.scala:32)
at scala.tools.nsc.Driver.process(Driver.scala:67)
at io.bazel.rulesscala.scalac.ScalacWorker.compileScalaSources(ScalacWorker.java:226)
at io.bazel.rulesscala.scalac.ScalacWorker.work(ScalacWorker.java:70)
at io.bazel.rulesscala.worker.Worker.persistentWorkerMain(Worker.java:92)
at io.bazel.rulesscala.worker.Worker.workerMain(Worker.java:46)
at io.bazel.rulesscala.scalac.ScalacWorker.main(ScalacWorker.java:37)
Caused by: java.lang.ClassNotFoundException: io.bullet.borer.deriver.Deriver
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 75 more
---8<---8<--- End of log snippet, 2207 chars omitted ---8<---8<---
Target //test-dir:some_lib failed to build
我该如何解决这个错误? io.bullet.borer.deriver.Deriver
在依赖项和类路径中,但 JVM 看不到它。无法记录沙箱的类路径,因为 bazel 无法获取 WorkerResponce
。请帮助我。
我找到问题了。默认 scala_toolchain
有 direct
模式。所以它只看到在 scala_library
或 scala_macro_library
的 deps
字段中定义的依赖项。所以有两种方案可以解决这个问题:
所以对于当前的例子,我们需要定义所有的直接依赖。顺便说一句,当您执行 maven_install
时,它们已经下载完毕。现在我们只需要引用它们:
对于 borer
附加依赖项将是:
@maven//:io_bullet_borer_deriver_2_12
对于scala_logging
我们需要添加:
@maven//:org_slf4j_slf4j_api
对于 ujson
我们需要:
@maven//:com_lihaoyi_geny_2_12
@maven//:com_lihaoyi_upickle_core_2_12
Github example repository 的所有修复都在 fix
分支下的存储库中可用。
我是 Bazel 的初学者,我需要从 sbt
迁移。我使用 Scala Rules 构建我的应用程序。
我使用以下依赖项和以下别名(以防止拼写错误):
Alias | Group | Artifact | Version |
---|---|---|---|
borer_core |
io.bullet |
borer-core_2.12 |
1.6.3 |
borer_derivation |
io.bullet |
borer-derivation_2.12 |
1.6.3 |
scala_logging |
com.typesafe.scala-logging |
scala-logging_2.12 |
3.9.2 |
logback |
ch.qos.logback |
logback-classic |
1.2.3 |
tagging |
com.softwaremill.common |
tagging_2.12 |
2.2.1 |
ujson |
com.lihaoyi |
ujson_2.12 |
1.2.2 |
所有这些依赖项将由 JVM External Rules 安装。在 Workspace
:
dp_deps = [
borer_core,
borer_derivation,
scala_logging,
logback,
tagging,
ujson,
]
maven_install(
name = "maven",
artifacts = dp_deps,
repositories = ["http://repo1.maven.org/maven/"],
fetch_sources = True
)
然后我尝试在我的 BUILD
文件中用 scala_library 构建一个 jar
。看起来是这样的:
scala_library(
name = "some_lib",
srcs = glob(["some_lib/src/main/**/*.scala"]),
unused_dependency_checker_mode = 'warn',
deps = [
"@maven//:io_bullet_borer_core_2_12",
"@maven//:io_bullet_borer_derivation_2_12",
"@maven//:com_typesafe_scala_logging_scala_logging_2_12",
"@maven//:ch_qos_logback_logback_classic",
"@maven//:com_softwaremill_common_tagging_2_12",
"@maven//:com_lihaoyi_ujson_2_12"
]
)
然后我尝试使用以下命令构建它:
bazel build //test-dir:some_lib --verbose_failures
我收到以下日志错误: 错误:
ERROR: /Users/<edited>/test-dir/BUILD.bazel:136:14: scala //test-dir:some_lib failed: Worker process did not return a WorkResponse:
日志:
---8<---8<--- Start of log snippet, file at /private/var/tmp/_bazel_<edited>/07059176926c1842b8d4e633b0ddf1f4/bazel-workers/worker-7-Scalac.log ---8<---8<---
[... truncated ...]
scala.tools.nsc.typechecker.Macros$MacroExpander.expand(Macros.scala:622)
at scala.tools.nsc.typechecker.Macros$MacroExpander.apply(Macros.scala:609)
at scala.tools.nsc.typechecker.Macros.standardMacroExpand(Macros.scala:784)
at scala.tools.nsc.typechecker.Macros.standardMacroExpand$(Macros.scala:782)
at scala.tools.nsc.Global$$anon.standardMacroExpand(Global.scala:480)
at scala.tools.nsc.typechecker.AnalyzerPlugins$$anon.default(AnalyzerPlugins.scala:457)
at scala.tools.nsc.typechecker.AnalyzerPlugins$$anon.default(AnalyzerPlugins.scala:454)
at scala.tools.nsc.typechecker.AnalyzerPlugins.invoke(AnalyzerPlugins.scala:411)
at scala.tools.nsc.typechecker.AnalyzerPlugins.pluginsMacroExpand(AnalyzerPlugins.scala:454)
at scala.tools.nsc.typechecker.AnalyzerPlugins.pluginsMacroExpand$(AnalyzerPlugins.scala:454)
at scala.tools.nsc.Global$$anon.pluginsMacroExpand(Global.scala:480)
at scala.tools.nsc.typechecker.Macros.macroExpand(Macros.scala:773)
at scala.tools.nsc.typechecker.Macros.macroExpand$(Macros.scala:766)
at scala.tools.nsc.Global$$anon.macroExpand(Global.scala:480)
at scala.tools.nsc.typechecker.Typers$Typer.vanillaAdapt(Typers.scala:1164)
at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1227)
at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1200)
at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1220)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5747)
at scala.tools.nsc.typechecker.Typers$Typer.typedValDefImpl(Typers.scala:5949)
at scala.tools.nsc.typechecker.Typers$Typer.typedValDef(Typers.scala:2056)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5651)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5733)
at scala.tools.nsc.typechecker.Typers$Typer.typedStat(Typers.scala:5797)
at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedStats(Typers.scala:3357)
at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3357)
at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:2017)
at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef(Typers.scala:1883)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5654)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5733)
at scala.tools.nsc.typechecker.Typers$Typer.typedStat(Typers.scala:5797)
at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedStats(Typers.scala:3357)
at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3357)
at scala.tools.nsc.typechecker.Typers$Typer.typedPackageDef(Typers.scala:5363)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5656)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5733)
at scala.tools.nsc.typechecker.Analyzer$typerFactory$TyperPhase.apply(Analyzer.scala:115)
at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:451)
at scala.tools.nsc.typechecker.Analyzer$typerFactory$TyperPhase.run(Analyzer.scala:104)
at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1501)
at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1485)
at scala.tools.nsc.Global$Run.compileSources(Global.scala:1478)
at scala.tools.nsc.Global$Run.compile(Global.scala:1604)
at scala.tools.nsc.Driver.doCompile(Driver.scala:47)
at scala.tools.nsc.MainClass.doCompile(Main.scala:32)
at scala.tools.nsc.Driver.process(Driver.scala:67)
at io.bazel.rulesscala.scalac.ScalacWorker.compileScalaSources(ScalacWorker.java:226)
at io.bazel.rulesscala.scalac.ScalacWorker.work(ScalacWorker.java:70)
at io.bazel.rulesscala.worker.Worker.persistentWorkerMain(Worker.java:92)
at io.bazel.rulesscala.worker.Worker.workerMain(Worker.java:46)
at io.bazel.rulesscala.scalac.ScalacWorker.main(ScalacWorker.java:37)
Caused by: java.lang.ClassNotFoundException: io.bullet.borer.deriver.Deriver
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 75 more
---8<---8<--- End of log snippet, 2207 chars omitted ---8<---8<---
Target //test-dir:some_lib failed to build
我该如何解决这个错误? io.bullet.borer.deriver.Deriver
在依赖项和类路径中,但 JVM 看不到它。无法记录沙箱的类路径,因为 bazel 无法获取 WorkerResponce
。请帮助我。
我找到问题了。默认 scala_toolchain
有 direct
模式。所以它只看到在 scala_library
或 scala_macro_library
的 deps
字段中定义的依赖项。所以有两种方案可以解决这个问题:
所以对于当前的例子,我们需要定义所有的直接依赖。顺便说一句,当您执行 maven_install
时,它们已经下载完毕。现在我们只需要引用它们:
对于 borer
附加依赖项将是:
@maven//:io_bullet_borer_deriver_2_12
对于scala_logging
我们需要添加:
@maven//:org_slf4j_slf4j_api
对于 ujson
我们需要:
@maven//:com_lihaoyi_geny_2_12
@maven//:com_lihaoyi_upickle_core_2_12
Github example repository 的所有修复都在 fix
分支下的存储库中可用。