Mac中安装Thrift和使用

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>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值