This project tries to make the gRPC code generation easy.
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.
- When you need to build a gRPC service, first clone this repository to your workspace.
- Define your API interface and DTO (Data Transfer Object) in proto files in
src/main/proto
. - Use one of the following commands to generate your artifact.
- Include the packaged artifact in your project.
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/
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.
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/
.