My aim is to use akka-grpc
in my project. By using the walkthrough, https://developer.lightbend.com/docs/akka-grpc/current/client/walkthrough.html I tried to generate Scala files. However, whenever I build the project (by mvn clean package
) it generates Java files instead of Scala files. Is there a way to generate Scala files? I already tried converting Java to Scala but it did not work.
Here is my proto file (the same one in the walkthrough):
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;
}
You should specify this in your maven configuration. From the docs:
<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>