user01 user01 - 11 months ago 99
Java Question

Protocol buffers compiler maven plugin

I have protocol buffers compiler plugin configured in my POM that is executed whenever the project is built. This complier plugin works fine in windows but now I moved my project to an ubuntu PC & need to used a suitable alterntive for this.

<mkdir dir="src/main/resources/protocolBuffers/compiled" />
<path id="proto.path">
<fileset dir="src/main/proto">
<include name="**/*.proto" />
<pathconvert pathsep=" " property="proto.files" refid="proto.path" />
<exec executable="src/main/resources/protocolBuffers/compiler/protoc" failonerror="true">
<arg value="--java_out=src/main/resources/" />
<arg value="-I${project.basedir}/" />
<arg line="${proto.files}"/>

I see the following output when trying to build the project in Ubuntu netbeans

--- maven-antrun-plugin:1.3:run (compile-protoc) @ Px10App ---
Executing tasks
Total time: 5.638s
Finished at: Tue Mar 25
Final Memory: 9M/105M
Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.3:run (compile-protoc) on project Px10App: An Ant BuildException has occured: Execute failed: Cannot run program "src/main/resources/protocolBuffers/compiler/protoc": error=2, No such file or directory -> [Help 1]

How to make compiler plugin work in Ubuntu netbeans ?

Answer Source

Your protoc executable could not be executed on linux. You should download and compile protoc for linux and once you do it you will be able to use this maven plug-in as you are using it on windows.

You have detailed instruction for this here