Why is IntelliJ IDEA not seeing HttpClients?
I added the following to the dependencies section of my pom.xml:
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.4.1</version>
<scope>test</scope>
</dependency>
But when I add the 1st line "Quick Start Guide" ( http://hc.apache.org/httpcomponents-client-4.4.x/quickstart.html ):
CloseableHttpClient httpclient = HttpClients.createDefault();
IntelliJ IDEA highlights "HttpClients" and tells me:
Cannot resolve symbol "HttpClients"
It looks like I have a configuration error. What exactly is wrong? Please advise how to add support for HttpClients to the project?
Thank!
PS Did a bit more research, it looks like "" is redundant and wrong for this case, I removed it, but it didn't help: still not compileable.
EDIT: If I hover over "HttpClients" and press "Alt-enter", the popup does not contain any class to import. See screenshot:
source to share
It looks like my IntelliJ was having caching issues, clearing the cache and then re-importing the project.
I found some advice on this: IntelliJ check gives "Unable to resolve symbol" but still compiles the code
PS Although several other projects were broken as a result of this action. Looks like I need to learn :)
source to share
Download the jar file from https://jar-download.com/artifacts/org.apache.httpcomponents/httpclient/4.5.6/source-code
Extract the name of the .jar file httpclient-4.5.6.jar. Create a lib directory in your project and import this .jar file into it. Right click on your .jar file and select addtolibrary.
source to share