How Do I Pull in Apache httpComponents Using Maven in Eclipse

Ok. So I'm using maven (which honestly just giving me a headache because of reasons like this).

Put this in my pom file:

maven started doing something... you know, Percentage increasing, progress bar etc lower right corner of Eclipse.

Tried to paste in code from this site so I can try out the library:

But I get

Cannot be resolved to a type

It ended up here in build path window.

I tried run maven clean. Did not help. I am using Maven project. There is even a small little "M" on my project folder :)

I also found where the jars where and added them manually to webapp/WEB-INF/lib folder. That's why you see them in Classpath in picture above. I'm Using Tomcat. I believe this worked before with gson etc.

It is not often that I need to mess with Maven, so I forget in between, and then each time I spend hours, when in fact I believe it should be a simple thing to add a jar.

Surely I must be missing some common practice of how to simply add a dependency using maven in Eclipse.

I have been struggling for 2,5 hours now.

1 Answer

You also need the httpclient artifact, as that's the resulting jar file for the repository you pulled code out of. See .

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Sarah Jenkins

Sarah Jenkins

Senior Technology Editor & AI Specialist

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.

Share this article
Twitter Facebook Pinterest