thrift 的安裝編譯java
1 : 從官網下載最新的包 http://thrift.apache.org/download thrift-0.9.3.tar.gzapache
2 :解壓 thrift-0.9.3.tar.gz 包; tar -zxvf thrift-0.9.3.tar.gz 生成目錄 thrift-0.9.3maven
3 :進入thrift-0.9.3 目錄 執行 ./configurate --with-javaui
執行過程當中若是出現錯誤 error: Bison version 2.5 or higher must be installed on the system! 說明 Bison 版本低了 須要從新裝下 wget http://ftp.gnu.org/gnu/bison/bison-3.0.4.tar.gz tar -zxvf bison-3.0.4.tar.gz cd bison-3.0.4 ./configure make && make install
4 : make && make install插件
5 : mavne 配置插件 支持 代碼自動生成;執行mvn clean install 後便可從新生成源文件code
<build> <plugins> <plugin> <groupId>org.apache.thrift.tools</groupId> <artifactId>maven-thrift-plugin</artifactId> <version>0.1.11</version> <executions> <execution> <id>thrift-sources</id> <phase>generate-sources</phase> <goals> <goal>compile</goal> </goals> </execution> <execution> <id>thrift-test-sources</id> <phase>generate-test-sources</phase> <goals> <goal>testCompile</goal> </goals> </execution> </executions> </plugin> </plugins> </build>