Scala协议缓冲区和Maven问题



我的要求是在Scala Play上使用协议缓冲区!REST API项目,我很难添加它。我按照文档中的说明操作,但它总是失败。它看起来是这样的:我build.sbt

scalaVersion := "2.13.10"
dependencyOverrides += "org.scala-lang.modules" %% "scala-java8-compat" % "1.0.0"
libraryDependencies ++= Seq(
guice,
"org.scalatestplus.play" %% "scalatestplus-play" % "5.0.0" % Test,
"mysql" % "mysql-connector-java" % "8.0.26",
"io.getquill" %% "quill-jasync-mysql" % "4.6.0",
"com.thesamet.scalapb" %% "scalapb-runtime" % "0.11.11"
)

project/scalapb.sbt

addSbtPlugin("com.thesamet" % "sbt-protoc" % "1.0.3")

并尝试编译项目,我得到这样的输出:

[error] stack trace is suppressed; run last protocExecutable for the full output
[error] (protocExecutable) lmcoursier.internal.shaded.coursier.error.FetchError$DownloadingArtifacts: Error fetching artifacts:
[error] https://repo1.maven.org/maven2/com/google/protobuf/protoc/3.15.6/protoc-3.15.6-osx-aarch_64.exe: not found: https://repo1.maven.org/maven2/com/google/protobuf/protoc/3.15.6/protoc-3.15.6-osx-aarch_64.exe
[error] Total time: 0 s, completed 4 Apr 2023, 14:26:17

请建议如何解决这个问题。谢谢你

我已经尝试过清理、更新和重新加载。我重新启动了整个项目,但它似乎不起作用。我做错了什么?

根据错误信息中的URL,我假设您正在使用Apple Silicon M1或M2平台arch 64架构。

但是protoc的官方版本3.15.6还不支持这个架构。

第一个支持的版本是:3.17.3该片于2021年7月上映。

选项1。

sbt-protoc升级到1.0.6及以上。

addSbtPlugin("com.thesamet" % "sbt-protoc" % "1.0.6")

选项2。

安装Rosetta以能够在aarch64架构上运行x86_64二进制文件。

最新更新