Generate Thrift code using a maven profile
Signed-off-by: stack <stack@apache.org>
This commit is contained in:
parent
9102547159
commit
cc71d35112
|
@ -33,15 +33,15 @@ It combines a software stack with a code generation engine to build services
|
|||
that work efficiently and seamlessly between C++, Java, Python, PHP, Ruby,
|
||||
Erlang, Perl, Haskell, C#, Cocoa, Smalltalk, and OCaml."</blockquote>
|
||||
|
||||
<h2><a name="description">Description</a></h2>
|
||||
|
||||
<p><i>Important note:</i> We tried to deprecate this Thrift interface and replace it
|
||||
<h2>Important note</h2>
|
||||
<p><b><u>We tried to deprecate this Thrift interface and replace it
|
||||
with the Interface defined over in the thrift2 package only this package will not die.
|
||||
Folks keep adding to it and fixing it up so its around for another while until someone
|
||||
takes command and drives this package out of existence replacing it w/ an Interface that
|
||||
better matches the hbase API (this package was modelled on old HBase API long since dropped).
|
||||
</p>
|
||||
</u></b></p>
|
||||
|
||||
<h2><a name="description">Description</a></h2>
|
||||
<p>The org.apache.hadoop.hbase.thrift.generated.Hbase.Iface HBase API is defined in the
|
||||
file <a href="doc-files/index.html">Hbase.thrift</a> (Click the former to see the
|
||||
thrift generated documentation of thrift interface). A server-side implementation of the API is in
|
||||
|
@ -93,11 +93,7 @@ These are the command line arguments the Thrift server understands in addition t
|
|||
|
||||
<p>The files were generated by running the commands under the hbase checkout dir:
|
||||
<pre>
|
||||
thrift -strict --gen java:hashcode ./hbase-server/src/main/resources/org/apache/hadoop/hbase/thrift/Hbase.thrift
|
||||
# Move the generated files into place their expected location under hbase
|
||||
mv gen-java/org/apache/hadoop/hbase/thrift/generated/* hbase-server/src/main/java/org/apache/hadoop/hbase/thrift/generated/
|
||||
# Remove the gen-java file made by thrift
|
||||
rm -rf gen-java
|
||||
mvn compile -Pcompile-thrift
|
||||
</pre>
|
||||
|
||||
<p>The 'thrift' binary is the Thrift compiler, and it is distributed as a part
|
||||
|
|
|
@ -257,6 +257,7 @@
|
|||
<artifactId>jasper-runtime</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
<!-- Skip the tests in this module -->
|
||||
<profile>
|
||||
|
@ -271,6 +272,117 @@
|
|||
<surefire.skipSecondPart>true</surefire.skipSecondPart>
|
||||
</properties>
|
||||
</profile>
|
||||
|
||||
<!--
|
||||
Profile for regenerating the thrift java classes.
|
||||
The generated files are to be committed to version control.
|
||||
Activate using:
|
||||
mvn compile -Dcompile-thrift
|
||||
-->
|
||||
<profile>
|
||||
<id>compile-thrift</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-enforcer-plugin</artifactId>
|
||||
<version>1.3.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>enforce-thrift-version</id>
|
||||
<goals>
|
||||
<goal>enforce</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<rules>
|
||||
<requireProperty>
|
||||
<property>thrift.version</property>
|
||||
<message>"The Thrift version must be specified."</message>
|
||||
<regex>0\.9\.0</regex>
|
||||
<regexMessage>
|
||||
-
|
||||
-
|
||||
[FATAL] ==========================================================================================
|
||||
[FATAL] HBase Thrift requires the thrift generator version 0.9.0.
|
||||
[FATAL] Setting it to something else needs to be reviewed for wire and behavior compatibility.
|
||||
[FATAL] ==========================================================================================
|
||||
-
|
||||
-
|
||||
</regexMessage>
|
||||
</requireProperty>
|
||||
</rules>
|
||||
<fail>true</fail>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>check-thrift-version</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>sh</executable>
|
||||
<workingDirectory>${basedir}</workingDirectory>
|
||||
<arguments>
|
||||
<argument>-c</argument>
|
||||
<argument>${thrift.path} -version | \
|
||||
fgrep 'Thrift version ${thrift.version}' && exit 0;
|
||||
echo "========== [FATAL] Need Thrift version ${thrift.version} ==========";
|
||||
exit 1</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>thrift</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>${thrift.path}</executable>
|
||||
<workingDirectory>${basedir}</workingDirectory>
|
||||
<arguments>
|
||||
<argument>-strict</argument>
|
||||
<argument>--gen</argument>
|
||||
<argument>java:hashcode</argument>
|
||||
<argument>-out</argument>
|
||||
<argument>${basedir}/src/main/java</argument>
|
||||
<argument>${basedir}/src/main/resources/org/apache/hadoop/hbase/thrift/Hbase.thrift</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>thrift2</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>${thrift.path}</executable>
|
||||
<workingDirectory>${basedir}</workingDirectory>
|
||||
<arguments>
|
||||
<argument>-strict</argument>
|
||||
<argument>--gen</argument>
|
||||
<argument>java:hashcode</argument>
|
||||
<argument>-out</argument>
|
||||
<argument>${basedir}/src/main/java</argument>
|
||||
<argument>${basedir}/src/main/resources/org/apache/hadoop/hbase/thrift2/hbase.thrift</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
|
||||
<!-- profile against Hadoop 1.1.x: This is the default. It has to have the same
|
||||
activation property as the parent Hadoop 1.1.x profile to make sure it gets run at
|
||||
the same time. -->
|
||||
|
|
|
@ -91,11 +91,7 @@ These are the command line arguments the Thrift server understands in addition t
|
|||
<p>HBase currently uses version 0.9.0 of Apache Thrift.</p>
|
||||
<p>The files were generated by running the commands under the hbase checkout dir:
|
||||
<pre>
|
||||
thrift -strict --gen java:hashcode ./hbase-thrift/src/main/resources/org/apache/hadoop/hbase/thrift2/hbase.thrift
|
||||
# Move the generated files into place their expected location under hbase
|
||||
mv gen-java/org/apache/hadoop/hbase/thrift2/generated/* hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/generated/
|
||||
# Remove the gen-java file made by thrift
|
||||
rm -rf gen-java
|
||||
mvn compile -Pcompile-thrift
|
||||
</pre>
|
||||
|
||||
<p>The 'thrift' binary is the Thrift compiler, and it is distributed separately from HBase
|
||||
|
|
1
pom.xml
1
pom.xml
|
@ -1012,6 +1012,7 @@
|
|||
<log4j.version>1.2.17</log4j.version>
|
||||
<mockito-all.version>1.10.8</mockito-all.version>
|
||||
<protobuf.version>2.5.0</protobuf.version>
|
||||
<thrift.path>thrift</thrift.path>
|
||||
<thrift.version>0.9.0</thrift.version>
|
||||
<zookeeper.version>3.4.6</zookeeper.version>
|
||||
<slf4j.version>1.7.7</slf4j.version>
|
||||
|
|
|
@ -396,7 +396,7 @@ Access restriction: The method getLong(Object, long) from the type Unsafe is not
|
|||
<title>Build Protobuf</title>
|
||||
<para>You may need to change the protobuf definitions that reside in the
|
||||
<filename>hbase-protocol</filename> module or other modules.</para>
|
||||
<para> The protobuf files are located
|
||||
<para> The protobuf files are located in
|
||||
<filename>hbase-protocol/src/main/protobuf</filename>. For the change to be
|
||||
effective, you will need to regenerate the classes. You can use maven profile
|
||||
<code>compile-protobuf</code> to do this.</para>
|
||||
|
@ -410,6 +410,22 @@ mvn compile -Pcompile-protobuf -Dprotoc.path=/opt/local/bin/protoc
|
|||
</para>
|
||||
</section>
|
||||
|
||||
<section xml:id="build.thrift">
|
||||
<title>Build Thrift</title>
|
||||
<para>You may need to change the thrift definitions that reside in the
|
||||
<filename>hbase-thrift</filename> module or other modules.</para>
|
||||
<para>The thrift files are located in
|
||||
<filename>hbase-thrift/src/main/resources</filename>.
|
||||
For the change to be effective, you will need to regenerate the classes.
|
||||
You can use maven profile <code>compile-thrift</code> to do this.</para>
|
||||
<programlisting language="bourne">mvn compile -Pcompile-thrift</programlisting>
|
||||
<para>You may also want to define <varname>thrift.path</varname> for the thrift
|
||||
binary, using the following command:</para>
|
||||
<programlisting language="bourne">
|
||||
mvn compile -Pcompile-thrift -Dthrift.path=/opt/local/bin/thrift
|
||||
</programlisting>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Build a Tarball</title>
|
||||
<para>You can build a tarball without going through the release process described in
|
||||
|
|
Loading…
Reference in New Issue