Reference Guide

Table Of Contents
We recommend under the project you wish to define and use GBP you place .proto files
under the /src/main/proto directory. You can then make use of the GPB “option
java_package” syntax to control the subdirectory/package structure that will be created for
the generated Java code from the .proto file.
The projects pom.xml file requires the following GPB related fields:
<dependencies>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>2.5.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>com.google.protobuf.tools</groupId>
<artifactId>maven-protoc-plugin</artifactId>
<version>0.3.2</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
After running “mvn clean install” on the pom.xml file GPB’s protoc will be used to:
· Generate the necessary Java files under:
./target/generated-sources/protobuf/java/<optional java_package directory>
· Compile the generated Java file into class files
79