0

Updating question as I've progressed from the original problem.

Step 1. I've compiled and Installed Protobuf Compiler for mac using this link.

Step 2. Currently stuck at gRPC Java Codegen Plugin for Protobuf Compiler link:

Successful ../gradlew java_pluginExecutable

Error ../gradlew test (screenshot 1)

*** Building codegen requires Protobuf version 3.9.0


which protoc outputs /usr/local/bin/protoc

protoc --version outputs libprotoc 3.9.0

P.S. Please also mention in your solution what to do next once I'm able to compile java generator, I plan to use the plugin from command line initially.

enter image description here

AppDeveloper
  • 1,816
  • 7
  • 24
  • 49
  • Possible duplicate: https://stackoverflow.com/a/31031346/7736617 – Arnaud Claudel Aug 06 '19 at 11:16
  • I tried the example from the linked question, and got this error, `--grpc-java_out: protoc-gen-grpc-java: Plugin failed with status code 1.` what's next for me? Where do I find and install this plugin? – AppDeveloper Aug 06 '19 at 11:18
  • The answer also provides a link to the documentation, which provides an example. https://github.com/grpc/grpc-java/tree/master/compiler – Arnaud Claudel Aug 06 '19 at 11:22
  • ok, followed the steps. I've compiled for my system (mac), and installed the codegen to maven repository using `../gradlew publishToMavenLocal`, the plugin fail error persists, what's next please? – AppDeveloper Aug 06 '19 at 11:31
  • i've added this to the command with path to .m2 `--plugin=protoc-gen-grpc-java=~/.m2/repository/protoc-gen-grpc-java --grpc-java_out=path/to/output/dir` I don't see however, the file under .m2, so where do I find `protoc-gen-grpc-java` file? – AppDeveloper Aug 06 '19 at 11:33
  • It should be in `io/grpc/protoc-gen-grpc-java/` but you should be able to download a compiled one, https://repo1.maven.org/maven2/io/grpc/protoc-gen-grpc-java/1.22.1/ – Arnaud Claudel Aug 06 '19 at 11:54
  • made progress but stuck at this `Building codegen requires Protobuf version 3.9.0`, however, `protoc --version` returns `libprotoc 3.9.0` – AppDeveloper Aug 06 '19 at 13:06
  • What's exactly you problem ? Update your question with the new elements – Arnaud Claudel Aug 06 '19 at 13:37
  • question updated, please have a look – AppDeveloper Aug 06 '19 at 14:20
  • Have you try with a compiled one ? I can't reproduce, it's working for me – Arnaud Claudel Aug 06 '19 at 14:59
  • took another route, from inside `protobuf-3.9.0/java` i ran `mvn install`, error screenshot. https://i.stack.imgur.com/APw6o.png – AppDeveloper Aug 06 '19 at 15:10
  • @ArnaudClaudel I'm still stuck at getting this java gen grpc to compile, instead can you plese provide me the jar file? – AppDeveloper Aug 06 '19 at 16:34

2 Answers2

0

I don't know what is your use case, maybe you do not have build the codegen by yourself. As in the link https://github.com/grpc/grpc-java/blob/master/COMPILING.md

Since many Java developers don't have C compilers installed and don't need to run or modify the codegen, the build can skip it. To skip, create the file /gradle.properties and add skipCodegen=true.

If you really need to, there are steps you can follow in that link too.

Ran
  • 1
0

https://github.com/grpc/grpc-java/tree/master/compiler

This link now contains detailed generation command and where the prebuilt protoc-gen-grpc plugin can be downloaded.

Where and how to download the pre-built protoc-gen-rpc plugin:

  1. Navigate to https://mvnrepository.com/artifact/io.grpc/protoc-gen-grpc-> 2. java
  2. Click into a version
  3. Click "Files"
  4. Select and download the one that is compatible with your system

Generate code with command line tool protoc

$ protoc --plugin=protoc-gen-grpc-java=/path/to/your/downloaded/protoc-gen-grpc-java \
  --grpc-java_out="$OUTPUT_FILE" --proto_path="$DIR_OF_PROTO_FILE" "$PROTO_FILE"
lotuc
  • 41
  • 4