造成thrift 編譯構建項目失敗的原因之一:thrift環境變量沒設置


由於重裝了系統和IDEA工具,打開原項目時使用install 構建使用thrift 協議的項目時失敗。下面是說說我遇到的問題

 

看下圖,就是構建時控制台輸出的日志,因為是亂碼,當時沒重視,就先去檢查pom.xml文件配置是否正確

 

檢查了pom配置沒有問題,上網找的信息也非常少,只能想辦法解決亂碼看看日志輸出的具體錯誤信息

<dependency>
		  <groupId>org.apache.thrift</groupId>
		  <artifactId>libthrift</artifactId>
		  <version>0.9.3</version>
		</dependency>

 <plugin>
    

 <plugin>
	            <groupId>org.apache.thrift.tools</groupId>
	            <artifactId>maven-thrift-plugin</artifactId>
	            <version>0.1.11</version>
	            <configuration>
	                <thriftExecutable>thrift</thriftExecutable>
	            </configuration>
	            <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>

  

解決控制台亂碼設置

 

重新構建了下,知道了具體原因,才想起還需要配置thrift.exe windows環境(2年沒動過了重裝系統后忘記步驟了)

 

去官網http://thrift.apache.org/download 下載thrift.exe,然后設置環境變量的 path 變量,把thrift.exe 所在目錄加上就行

最后打開cmd 驗證是否成功:thrift -version

輸出版本號信息代表設置成功

Thrift version 0.9.3

 

然后重啟IDEA開發工具,重新構建就成功了 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM