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>