thrift package报错问题解决 No field key specified for locId, resulting protocol may have conflicts or n...

今天打包一个thrift IDL项目 遇到一个错误。在这里记录一下解决方案

[ERROR] thrift failed error: [FAILURE:generation:1] Cannot use reserved language keyword: "from"
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.464 s
[INFO] Finished at: 2021-04-14T19:49:59+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.thrift.tools:maven-thrift-plugin:0.1.10:compile (thrift-sources) on project o2o-thrift: thrift did not exit cleanly. Review output for more information. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

No field key specified for locId, resulting protocol may have conflicts or not be backwards compatib  ``` 

经过搜索发现是本机没有安装thrift导致的错误,
使用brew安装一下
``` brew install thrift ```
安装后看一下有没有装成功
 ``` thrift -version ```
安装后还是报错,经过排查发现是版本和项目中的thrift版本不符
项目中用的是0.5.0版本,卸载装好的thrift
 ``` brew uninstall thrift ```
然后到官网下载指定版本的安装包
 ``` https://thrift.apache.org/download ```

unzip thrift-0.5.0.zip
cd thrift-0.5.0
./configure
make
make install ```

然后验证一下
thrift -version
看到提示 Thrift version 0.5.0 安装成功啦

再次mvn package打包一下项目,成功了

参考资料:
https://github.com/stripe-archive/herringbone/issues/2
https://cloud.tencent.com/developer/article/1451267

你可能感兴趣的:(thrift package报错问题解决 No field key specified for locId, resulting protocol may have conflicts or n...)