找不到org.apache.http.annotation.NotThreadSafe的类文件

问题现象

最近在做一个调用包含请求体的GET请求功能的时候,引用了 httpclient-4.5.2.jar 和 httpcore-4.4.5.jar。

在工程编译环节报错如下:
在这里插入图片描述

原因分析

httpcorehttpclient 的版本不匹配。


解决方案

httpcore 的版本由 4.4.5 改为 4.4.4,Maven引用如下:

<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.4</version>
</dependency>

猜你喜欢

转载自blog.csdn.net/aikudexiaohai/article/details/132126642