I'm finding problems with building protoc jar which is meant for generating java class files from proto files. I'd really appreciate any kind of direction or help in setting up the project to a level where I can generate java class files from .proto files
I have imported the following projects from protobuf git repo, but have been unable to find the protoc.exe file in the project directories.
The projects themselves complain about not being able to reference certain classes.
When I tried compiling and building the protobuf-parent project with maven,I get errors as show below
main:
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Protocol Buffers [Parent] .......................... SUCCESS [ 0.173 s]
[INFO] Protocol Buffers [Core] ............................ FAILURE [ 0.736 s]
[INFO] Protocol Buffers [Util] ............................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.347 s
[INFO] Finished at: 2017-08-30T20:52:49-07:00
[INFO] Final Memory: 16M/220M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.8:run (compile-protoc) on project protobuf-java: An Ant BuildException has occured: C:\scratch1\protobuf\protobuf-master\java\core\src\main\proto does not exist.
[ERROR] around Ant part ...<pathconvert property="proto.files" pathsep=" " refid="proto.path"/>... @ 10:71 in C:\scratch1\protobuf\protobuf-master\java\core\target\antrun\build-main.xml
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
I recommend you to use a precompiled protoc.exe binary file on Windows. Download protoc-x.x.x-win32.zip and protoc-x.x.x-java.zip packages
Unzip files you should get a folders like this (listing only few key files):
Compile java project using Maven, see this helper bat script:
You should find jar files in the following folders, these are the files you embed to your project when using MyStructureProto.java or other protobuf objects (bytes to object, object to bytes).
Use protoc.exe to create java implementation from .proto template descriptor: