我正在尝试使用 scalaPB 的官方示例来实现简单的服务器客户端应用程序。scala 代码可以在他们的gitHub上找到
但是,当我尝试运行它时,object helloworld is not a member of package io.grpc.examples.helloworld
当我尝试使用import io.grpc.examples.helloworld.helloworld.{foo}
.
我的 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