Improve Gradle instructions in README.md

This improves the "Getting started" section of
README.md for Gradle users.

Signed-off-by: Abhishek Singh <tech.singh.abhishek@gmail.com>
This commit is contained in:
Abhishek Singh
2025-05-23 12:50:59 +05:30
committed by Chris Bono
parent f560c1d75c
commit da5b55cbe3

View File

@@ -25,7 +25,7 @@ Define a `.proto` service definition file `src/main/proto/hello.proto` with the
syntax = "proto3";
option java_multiple_files = true;
option java_package = "org.springframework.grpc.sample.proto";
option java_package = "org.springframework.grpc.sample.proto"; // !IMP: change the package name to the one you mentioned in spring initilizr
option java_outer_classname = "HelloWorldProto";
// The greeting service definition.
@@ -58,7 +58,9 @@ or
./gradlew build
```
Youll get two new folders in the `target` directory (or `build` for Gradle): `target/target/generated-sources/protobuf/grpc-java` and `target/target/generated-sources/protobuf/java`. You may need to instruct your IDE to mark them as source roots. In IntelliJ IDEA, youd right click the folder, choose `Mark Directory As` -> `Generated Source Root`. Eclipse or VSCode will add them automatically for you.
Youll get two new folders in the `target` directory: `target/target/generated-sources/protobuf/grpc-java` and `target/target/generated-sources/protobuf/java`.
(_For gradle_, refer the `build` directory: `build/generated/source/proto/main/grpc` & `build/generated/source/proto/main/java`)
You may need to instruct your IDE to mark them as source roots. In IntelliJ IDEA, youd right-click the folder, choose `Mark Directory As` -> `Generated Source Root`. Eclipse or VSCode will add them automatically for you.
Now you can implement a service based on the generated stubs:
@@ -112,7 +114,7 @@ Run the program in the usual way:
or
```shell
./gradle bootRun
./gradlew bootRun
```
You can try it out using a gRPC client like `grpcurl`: