• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

caio/grpc-java-gradle-hello-world: A very basic quickstarter for using gRPC (the ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

caio/grpc-java-gradle-hello-world

开源软件地址(OpenSource Url):

https://github.com/caio/grpc-java-gradle-hello-world

开源编程语言(OpenSource Language):

Java 96.2%

开源软件介绍(OpenSource Introduction):

Java gRPC Hello World using Gradle

This code is pretty much gRPC's java hello world example, but on a separate repository and a bit opinionated on generated code placement.

Project Status

I don't have much of a reason to keep this up-to-date and have been doing so in an ad-hoc manner. Feel free to open issues and/or pull-requests and I will jump on it as soon as I can, just don't expect this repository to be always up-to-date and following the best practices of the month.

Contents

  • Java 1.8
  • Gradle 4.8
  • gRPC-java 1.12.0

Gradle Plugins

The following plugins are already setup (in build.gradle):

Quick start

NOTE: If you are behind a proxy, make sure you configure it by editing gradle.properties.

  • Rename the package
NEW_PACKAGE_NAME=my.company.and.project
./rename_package.bash $NEW_PACKAGE_NAME

(The rename_package.bash script is very hacky. It also relies on gnu-sed, so if yours is not in your PATH variable you can manually set it: SED=gsed ./rename_package.bash my.new.package)

  • Generate code and the IntelliJ's IDEA configuration:
./gradlew build
./gradlew idea
  • Import the project into IDEA

  • Start the server:

./gradlew runServer
# In another terminal
./gradlew runClient

If you want, you can also generate execution scripts and whatnot:

./gradlew installDist

Then you'll have the server at ./build/install/grpc-java-gradle-hello-world/bin/hello-world-server and the client at ./build/install/grpc-java-gradle-hello-world/bin/hello-world-client.

Generating code

A simple ./gradlew build will generate all code derived from the *.proto files and if using IDEA the same will happen and source sets will be properly configured (meaning that the IDE will automatically know about the generated files). If for whatever reason you need to generate code but don't want to call the build task, you can issue the following:

./gradlew generateProto

Updating dependencies

This project has the gradle-versions plugin set up, so if you want to check for updates you can run:

./gradlew dependencyUpdates -Drevision=release

And then update build.gradle with the new versions accordingly.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap