首页 > 解决方案 > Maven Spring Boot 应用程序找不到 org.apache.http

问题描述

我的 Spring Boot 应用程序需要调用 RESTful 服务,我想使用 apacheHttpClient来执行此操作。我在 pom.xml 中添加了依赖(尝试了不同的版本)

    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.0</version>
    </dependency>

但即使我可以看到在构建过程中下载了 .jar 文件:

Downloading from central: https://repo.maven.apache.org/maven2/org/apache/httpcomponents/httpclient/4.0/httpclient-4.0.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/httpcomponents/httpclient/4.0/httpclient-4.0.pom (6.0 kB at 14 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/httpcomponents/httpcomponents-client/4.0/httpcomponents-client-4.0.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/httpcomponents/httpcomponents-client/4.0/httpcomponents-client-4.0.pom (9.8 kB at 138 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/httpcomponents/httpclient/4.0/httpclient-4.0.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/httpcomponents/httpclient/4.0/httpclient-4.0.jar (290 kB at 1.1 MB/s)

但是在代码中我无法访问它的任何内容:

代码片段

我在这里想念什么?

标签: javaspring-bootmaven

解决方案


试试:文件| 使缓存无效/重新启动其他保存所有内容...重新启动 IntelliJ


推荐阅读