Coder Social home page Coder Social logo

mikibakaiki / grpc-java-gradle-hello-world Goto Github PK

View Code? Open in Web Editor NEW

This project forked from caio/grpc-java-gradle-hello-world

0.0 1.0 0.0 158 KB

A very basic quickstarter for using gRPC (the java implementation) with gradle as the build tool and support for generating an Intellij IDEA project

License: The Unlicense

Java 96.24% Shell 3.76%

grpc-java-gradle-hello-world's 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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.