【发布时间】:2022-01-01 15:53:36
【问题描述】:
我正在尝试使用 scalaPB 的official example 实现简单的服务器-客户端应用程序。 scala 代码在他们的gitHub
但是,当我尝试运行它时,当我尝试使用 import io.grpc.examples.helloworld.helloworld.{foo} 导入任何内容时,我不断收到错误 object helloworld is not a member of package io.grpc.examples.helloworld。
我的 build.sbt 文件:
name := "Distributed sorting"
version := "0.1"
scalaVersion := "2.13.7"
libraryDependencies ++= Seq(
"io.grpc" % "grpc-netty" % scalapb.compiler.Version.grpcJavaVersion,
"com.thesamet.scalapb" %% "scalapb-runtime-grpc" % scalapb.compiler.Version.scalapbVersion
)
Compile / PB.targets := Seq(
scalapb.gen() -> (Compile / sourceManaged).value / "scalapb"
)
我的文件如下所示:
├── build.sbt
├── project
│ ├── build.properties
│ ├── scalapb.sbt
│ └── target
├── ...
└── src/main
├── protobuf
├── hello.proto
└── scala/io/grpc/examples/helloworld
├── HelloWorldClient.scala
└── HelloWorldServer.scala
【问题讨论】:
标签: scala protocol-buffers grpc scalapb