The Culture of Code
  1. Posts/

Configuring Protobuf to Java compiler in maven

Here are few steps to configure protobuf-to-java compilation in your maven project:

Install google protobuf compiler on your computer.

Configure maven protobuf compiler plugin and dependency in pom.xml


    <!-- You may need to specify path to protobuf compiler -->



Create protobuf definition files within /src/main/protobuf/ directory. You may want to specify the following options in .proto files.

package com.example;
option java_multiple_files = true;
option java_outer_classname = "Messages";

mvn generate-sources and you’re done!