HBASE-9299 Generate the protobuf classes with hadoop-maven-plugin

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1518312 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2013-08-28 18:15:20 +00:00
parent e0e38c4e2f
commit b821c20689
3 changed files with 126 additions and 23 deletions

View File

@ -2,12 +2,13 @@ These are the protobuf definition files used by hbase. The produced java
classes are generated into src/main/java/org/apache/hadoop/hbase/protobuf/generated
and then checked in. The reasoning is that they change infrequently.
To regnerate the classes after making definition file changes, ensure first that
To regenerate the classes after making definition file changes, ensure first that
the protobuf protoc tool is in your $PATH (You may need to download it and build
it first; its part of the protobuf package obtainable from here:
http://code.google.com/p/protobuf/downloads/list). Then run the following (You
should be able to just copy and paste the below into a terminal and hit return
-- the protoc compiler runs fast):
http://code.google.com/p/protobuf/downloads/list).
Then run the following (You should be able to just copy and paste the below into a
terminal and hit return -- the protoc compiler runs fast):
UNIX_PROTO_DIR=src/main/protobuf
JAVA_DIR=src/main/java/
@ -18,10 +19,17 @@ should be able to just copy and paste the below into a terminal and hit return
else
PROTO_DIR=$UNIX_PROTO_DIR
fi
# uncomment the next line if you want to remove before generating
# rm -fr $JAVA_DIR/org/apache/hadoop/hbase/protobuf/generated
for PROTO_FILE in $UNIX_PROTO_DIR/*.proto
do
protoc -I$PROTO_DIR --java_out=$JAVA_DIR $PROTO_FILE
done
ll $JAVA_DIR/org/apache/hadoop/hbase/protobuf/generated
After you've done the above, check it in and then check it in (or post a patch
on a JIRA with your definition file changes and the generated files).
Optionally, you can uncomment the hadoop-maven-plugins plugin in hbase-protocol/pom.xml.
This plugin will generate for the classes during the build. Once again, you will need protocol buffers
to be installed on your build machine (https://developers.google.com/protocol-buffers)

View File

@ -55,8 +55,7 @@
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<!-- Always skip the second part executions, since we only run
simple unit tests in this module -->
<!-- Always skip the second part executions, since we only run simple unit tests in this module -->
<executions>
<execution>
<id>secondPartTestsExecution</id>
@ -70,7 +69,93 @@
</execution>
</executions>
</plugin>
<!--
<plugin>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-maven-plugins</artifactId>
<version>2.0.5-alpha</version>
<executions>
<execution>
<id>compile-protoc</id>
<phase>generate-sources</phase>
<goals>
<goal>protoc</goal>
</goals>
<configuration>
<protocVersion>${protobuf.version}</protocVersion>
<protocCommand>${protoc.path}</protocCommand>
<imports>
<param>${basedir}/src/main/protobuf</param>
</imports>
<source>
<directory>${basedir}/src/main/protobuf</directory>
<includes>
<include>AccessControl.proto</include>
<include>Admin.proto</include>
<include>Aggregate.proto</include>
<include>Authentication.proto</include>
<include>Cell.proto</include>
<include>Client.proto</include>
<include>ClusterId.proto</include>
<include>ClusterStatus.proto</include>
<include>Comparator.proto</include>
<include>ErrorHandling.proto</include>
<include>Filter.proto</include>
<include>FS.proto</include>
<include>hbase.proto</include>
<include>HFile.proto</include>
<include>LoadBalancer.proto</include>
<include>MapReduce.proto</include>
<include>MasterAdmin.proto</include>
<include>MasterMonitor.proto</include>
<include>Master.proto</include>
<include>MultiRowMutationProcessorMessages.proto</include>
<include>MultiRowMutation.proto</include>
<include>RegionServerStatus.proto</include>
<include>RowProcessor.proto</include>
<include>RPC.proto</include>
<include>SecureBulkLoad.proto</include>
<include>Tracing.proto</include>
<include>WAL.proto</include>
<include>ZooKeeper.proto</include>
</includes>
</source>
<output>${project.build.directory}/generated-sources/java</output>
</configuration>
</execution>
</executions>
</plugin>
-->
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-maven-plugins</artifactId>
<versionRange>[2.0.5-alpha,)</versionRange>
<goals>
<goal>protoc</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
@ -100,4 +185,5 @@
</properties>
</profile>
</profiles>
</project>

View File

@ -202,11 +202,20 @@ $ MAVEN_OPTS="-Xmx2g" mvn clean install deploy -DskipTests -Dhadoop.profile=2.0
</section>
<section xml:id="build.protobuf"><title>Build Protobuf</title>
<para>You may need to change the protobuf definitions that reside in the hbase-protocol module.</para>
<para>
The protobuf files are located in It is <link xlink:href="https://svn.apache.org/repos/asf/hbase/trunk/hbase-protocol/src/main/protobuf">hbase-protocol/src/main/protobuf</link>.
For the change to be effective, you will need to regenerate the classes (read the <link xlink:href="https://svn.apache.org/repos/asf/hbase/trunk/hbase-protocol/README.txt">hbase-protocol/README.txt</link> for more details).
</para>
</section>
<section xml:id="build.gotchas"><title>Build Gotchas</title>
<para>If you see <code>Unable to find resource 'VM_global_library.vm'</code>, ignore it.
Its not an error. It is <link xlink:href="http://jira.codehaus.org/browse/MSITE-286">officially ugly</link> though.
</para>
</section>
</section> <!-- build -->
<section xml:id="mvn_repo">
<title>Adding an Apache HBase release to Apache's Maven Repository</title>