org.apache.http不存在解决办法

hcwei 2021年01月04日 512次浏览

使用maven打包项目时提示org.apache.http.xxx不存在,如图
WechatIMG105.png
查阅资料发现这个jar包是过时的类,需要用其他jar包代替,通过pom.xml中引入下列依赖解决:

<dependency>
	<groupId>org.apache.httpcomponents</groupId>
	<artifactId>httpclient</artifactId>
	<version>4.5.2</version>
</dependency>
<dependency>
	<groupId>org.apache.httpcomponents</groupId>
	<artifactId>httpcore</artifactId>
 	<version>4.4.5</version>
</dependency>

参考博客:https://blog.csdn.net/tomcat_2014/article/details/50461954