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:

enter image description here

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

enter image description here

It ended up here in build path window. enter image description here

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

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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.

You Might Also Like