From b821c206895183794bdc6f173992b8239d46027c Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Wed, 28 Aug 2013 18:15:20 +0000 Subject: [PATCH] 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 --- .../{src/main/protobuf => }/README.txt | 16 ++- hbase-protocol/pom.xml | 124 +++++++++++++++--- src/main/docbkx/developer.xml | 9 ++ 3 files changed, 126 insertions(+), 23 deletions(-) rename hbase-protocol/{src/main/protobuf => }/README.txt (54%) diff --git a/hbase-protocol/src/main/protobuf/README.txt b/hbase-protocol/README.txt similarity index 54% rename from hbase-protocol/src/main/protobuf/README.txt rename to hbase-protocol/README.txt index f979619ed65..24e2b75b608 100644 --- a/hbase-protocol/src/main/protobuf/README.txt +++ b/hbase-protocol/README.txt @@ -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) diff --git a/hbase-protocol/pom.xml b/hbase-protocol/pom.xml index b5d74c9b7b3..75059d69159 100644 --- a/hbase-protocol/pom.xml +++ b/hbase-protocol/pom.xml @@ -32,7 +32,7 @@ Protobuf protocol classes used by HBase to communicate. - + org.apache.maven.plugins maven-site-plugin @@ -53,24 +53,109 @@ true - - maven-surefire-plugin - - - - secondPartTestsExecution - test - - test - - - true - - - - - + + maven-surefire-plugin + + + + secondPartTestsExecution + test + + test + + + true + + + + + + + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + org.apache.hadoop + hadoop-maven-plugins + [2.0.5-alpha,) + + protoc + + + + + + + + + + + + @@ -100,4 +185,5 @@ + diff --git a/src/main/docbkx/developer.xml b/src/main/docbkx/developer.xml index abbbbcafbd3..d4626c629fb 100644 --- a/src/main/docbkx/developer.xml +++ b/src/main/docbkx/developer.xml @@ -202,11 +202,20 @@ $ MAVEN_OPTS="-Xmx2g" mvn clean install deploy -DskipTests -Dhadoop.profile=2.0 +
Build Protobuf + You may need to change the protobuf definitions that reside in the hbase-protocol module. + + The protobuf files are located in It is hbase-protocol/src/main/protobuf. + For the change to be effective, you will need to regenerate the classes (read the hbase-protocol/README.txt for more details). + +
+
Build Gotchas If you see Unable to find resource 'VM_global_library.vm', ignore it. Its not an error. It is officially ugly though.
+
Adding an Apache HBase release to Apache's Maven Repository