0

我的目标是akka-grpc在我的项目中使用。通过使用演练,https://developer.lightbend.com/docs/akka-grpc/current/client/walkthrough.html我尝试生成 Scala 文件。但是,每当我构建项目(by mvn clean package)时,它都会生成 Java 文件而不是 Scala 文件。有没有办法生成 Scala 文件?我已经尝试将 Java 转换为 Scala,但没有成功。这是我的原型文件(演练中的同一个):

syntax = "proto3";

option java_multiple_files = true;
option java_package = "example.myapp.helloworld.grpc";
option java_outer_classname = "HelloWorldProto";

package helloworld;

// The greeting service definition.
service GreeterService {
    // Sends a greeting
    rpc SayHello (HelloRequest) returns (HelloReply) {}

    rpc ItKeepsTalking (stream HelloRequest) returns (HelloReply) {}

    rpc ItKeepsReplying (HelloRequest) returns (stream HelloReply) {}

    rpc StreamHellos (stream HelloRequest) returns (stream HelloReply) {}
}

// The request message containing the user's name.
message HelloRequest {
    string name = 1;
}

// The response message containing the greetings
message HelloReply {
    string message = 1;
}
4

1 回答 1

2

您应该在您的 Maven 配置中指定它。从文档

<plugin>
    <groupId>com.lightbend.akka.grpc</groupId>
    <artifactId>akka-grpc-maven-plugin</artifactId>
    <version>${akka.grpc.version}</version>
    <configuration>
      <language>Scala</language>
      <generateClient>false</generateClient>
      <generateServer>true</generateServer>
    </configuration>
</plugin>
于 2019-04-05T09:16:20.980 回答