Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

grpc - How to solve problem with compile protobuf in scala project on Windows10?

I have simple code with example protobuf on scala

proto file

syntax = "proto3";

package grpc.example;

message HelloRequest {
  string msg = 1;
  int32 code = 2;
}


message HelloResponse {
  string msg = 1;
}

service HelloWorld {
  rpc hello (HelloRequest) returns (HelloResponse);
}

plugins.sbt in project folder

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

libraryDependencies += "com.thesamet.scalapb" %% "compilerplugin" % "0.10.10"

build.sbt


name := "custom-grpc"

version := "0.1"

scalaVersion := "2.13.4"


lazy val protoExample = (project in file("proto-example"))
  .settings(

    PB.targets in Compile := Seq(
      scalapb.gen() -> (sourceManaged in Compile).value / "scalapb"
    ),
    libraryDependencies ++= Seq(
      "com.thesamet.scalapb" %% "scalapb-runtime" % scalapb.compiler.Version.scalapbVersion % "protobuf"
    ),
    scalaVersion := "2.13.4"
  )


lazy val root = (project in file("."))
  .aggregate(protoExample)

When in sbt shell call command compile I have error

[info] Compiling schema C:Users<.....>IdeaProjectsLearnScalacustom-grpcproto-examplesrcmainprotobufhello.proto
Error: Could not find or load main class protocbridge.frontend.BridgeApp
--jvm_0_out: protoc-gen-jvm_0: Plugin failed with status code 1.

What is error ??? I am use Windows10 and jdk 1.8 and then jdk 11.

question from:https://stackoverflow.com/questions/65848016/how-to-solve-problem-with-compile-protobuf-in-scala-project-on-windows10

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...