Skip to content

Latest commit

 

History

History
32 lines (20 loc) · 1.6 KB

README.md

File metadata and controls

32 lines (20 loc) · 1.6 KB

grpc-sample-api

This project tries to make the gRPC code generation easy.

How to use

Since each of the Java app using gRPC should separate API interfaces from the actual implementation, it would be convenient if we use a scaffold project for helping us to generate the gRPC code.

  1. When you need to build a gRPC service, first clone this repository to your workspace.
  2. Define your API interface and DTO (Data Transfer Object) in proto files in src/main/proto.
  3. Use one of the following commands to generate your artifact.
  4. Include the packaged artifact in your project.

Compile and install the artifact to your local Maven repo.

If you are just in developing your service and do not need to deploy the artifact to anywhere else. The following command would compile and install the package jar into your local repository.

$ mvn install

You can find the jar in somewhere like ~/.m2/repository/io/shihpeng/grpc-sample-api/0.0.1-SNAPSHOT/

Compile and deploy the artifact to the remote Maven repo.

Use the following command if you have done the development and want to deploy the artifact to a remote Maven repository so that the deploy pipeline could access the artifact.

$ mvn deploy

If you see any error message while trying to connect the repo, please check and update the connection information within the <distributionManagement> section in the pom.xml file.

Compile and just package the artifact as a jar.

Use the following command if you only need to package the artifact as a jar file.

$ mvn -o package

You can find the built jar in the following folder <project>/target/.