造成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开发工具,重新构建就成功了 

猜你喜欢

转载自www.cnblogs.com/jingping/p/10949414.html