Thrift安装教程,亲测有效:https://cloud.tencent.com/developer/article/1451267
https://www.cnblogs.com/jiwawa/p/10039795.html
安装完成之后我们需要配置环境变量:
https://www.cnblogs.com/quickcodes/p/5398709.html
https://www.cnblogs.com/smartloli/p/4220545.html thrift环境变量如何配置
Thrift安装还需要安装bison,并且thrift和bison版本要对应上
安装完成之后结合idea使用教程:
https://blog.csdn.net/u010900754/article/details/80172671
注意:idea依赖的包要跟你系统安装的thrift版本一致,否则会报错
<dependencies>
<dependency>
<groupId>org.apache.thrift</groupId>
<artifactId>libthrift</artifactId>
<version>0.9.3</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>utf-8</encoding>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-javac</artifactId>
<version>1.8.1</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.1</version>
<configuration>
<attach>true</attach>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.2</version>
<configuration>
<encoding>utf-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.thrift.tools</groupId>
<artifactId>maven-thrift-plugin</artifactId>
<version>0.1.12-SNAPSHOT</version>
<configuration>
<thriftExecutable>
//这个路径下的文件必须时thrift的执行文件
/usr/local/Cellar/thrift@0.9/0.9.3.1/bin/thrift
</thriftExecutable>
<!-- <thriftExecutable>
/usr/local/bin/thrift
</thriftExecutable>-->
<!-- <thriftExecutable>-->
<!--D:/thrift/thrift-0.9.0.exe-->
<!--</thriftExecutable>-->
</configuration>
<executions>
<execution>
<id>thrift-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>