今天打包一個(gè)thrift IDL項(xiàng)目 遇到一個(gè)錯(cuò)誤。在這里記錄一下解決方案
[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 ```
經(jīng)過搜索發(fā)現(xiàn)是本機(jī)沒有安裝thrift導(dǎo)致的錯(cuò)誤,
使用brew安裝一下
``` brew install thrift ```
安裝后看一下有沒有裝成功
``` thrift -version ```
安裝后還是報(bào)錯(cuò)弧呐,經(jīng)過排查發(fā)現(xiàn)是版本和項(xiàng)目中的thrift版本不符
項(xiàng)目中用的是0.5.0版本剪况,卸載裝好的thrift
``` brew uninstall thrift ```
然后到官網(wǎng)下載指定版本的安裝包
``` https://thrift.apache.org/download ```
unzip thrift-0.5.0.zip
cd thrift-0.5.0
./configure
make
make install ```
然后驗(yàn)證一下
thrift -version
看到提示 Thrift version 0.5.0
安裝成功啦
再次mvn package打包一下項(xiàng)目钥星,成功了
參考資料:
https://github.com/stripe-archive/herringbone/issues/2
https://cloud.tencent.com/developer/article/1451267