protobuf maven integration
<build>
<plugins>
<plugin>
<groupId>com.github.igor-petruk.protobuf</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.6.3</version>
<executions>
<execution>
<id>generate-sources</id>
<goals>
<goal>run</goal>
</goals>
<phase>install</phase>
<configuration>
<inputDirectories>
<directory>
${basedir}/src/protobuf/
</directory>
</inputDirectories>
<includes>
<param>**/*.proto</param>
</includes>
<outputDirectory>
${basedir}/src/generated-sources
</outputDirectory>
</configuration>
</execution>
</executions>
<configuration>
<protocExecutable>/usr/local/bin/protoc</protocExecutable>
</configuration>
</plugin>
</plugins>
</build>
// See README.txt for information and build instructions.
package tutorial;
option java_package = "com.example.tutorial";
option java_outer_classname = "AddressBookProtos";
message Person {
required string name = 1;
required int32 id = 2; // Unique ID number for this person.
optional string email = 3;
enum PhoneType {
MOBILE = 0;
HOME = 1;
WORK = 2;
}
message PhoneNumber {
required string number = 1;
optional PhoneType type = 2 [default = HOME];
}
repeated PhoneNumber phone = 4;
}
// Our address book file is just one of these.
message AddressBook {
repeated Person person = 1;
}
// See README.txt for information and build instructions.
package search;
option java_package = "com.tianji.rest.message";
option java_outer_classname = "Search";
message PSearchResponse {
required int32 numFound = 1;
repeated ResponseUserVO users = 2;
repeated FacetResponse facetResponse = 3;
}
message ResponseUserVO {
required int32 userId = 1;
repeated string skill = 2;
}
message KVPair {
required string key = 1;
required string value = 2;
}
message FacetResponse {
required string field = 1;
repeated KVPair facetItem = 2;
}
message UserSearchResponse {
required int32 numFound = 1;
repeated ResponseUserVO users = 2;
}
message ResponseBookVO {
required int32 id = 1;
optional string name = 2;
optional string mpic_url = 3;
optional string author = 4;
}
message BookSearchResponse {
required int32 numFound = 1;
repeated ResponseBookVO books = 2;
}