JavaFX gRPC Client Dependencies

青春壹個敷衍的年華 提交于 2019-12-25 11:28:28

问题


I am working on gRPC client(JavaFX) and server(SpringBoot with gRPC starter). The two application are independent and do not share any files together. The server is complete for testing(here)

I would like to make JavaFX client independently from the gRPC server, i.e without including gRPC server as a maven dependancy in client POM.

What gRPC client specific dependencies can i add in the javafx application and how to send request to the server?


回答1:


According to the official documentation (http://www.grpc.io/docs/quickstart/java.html) the examples can be used as a starting point https://github.com/grpc/grpc-java/blob/master/examples/build.gradle

The dependencies you need are

compile "io.grpc:grpc-netty:${grpcVersion}"
compile "io.grpc:grpc-protobuf:${grpcVersion}"
compile "io.grpc:grpc-stub:${grpcVersion}"

where ${grpcVersion} is whatever released version of gRPC you may want to use. This notation is for the Gradle build tool, however transforming to Maven coordinates is easy, such as

<dependency>
    <groupId>io.grpc</groupId>
    <artifactId>grpc-netty</artifactId>
    <version>1.2.0</version>
</dependency>

You'll find another working example at https://github.com/aalmiray/javatrove/tree/master/chat-02



来源:https://stackoverflow.com/questions/43188914/javafx-grpc-client-dependencies

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!