19

I am trying to add the Apache httpcomponents-client library to my Maven project. I have added a dependency to pom.xml (as found on http://mvnrepository.com/artifact/org.apache.httpcomponents/httpcomponents-client/4.1.1), but when building my Eclipse project Maven is unable to find and download the library.

I have made a test project which does nothing but include this library to ensure that it's not any other settings that cause problems:

<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>no.gundelsby.test</groupId>
<artifactId>NeedMyPackage</artifactId>
<version>0.1</version>
<dependencies>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpcomponents-client</artifactId>
        <version>4.1.1</version>
    </dependency>
</dependencies>
</project>

Building this project results in the same error.

Other things I have tested:

  • Tried building with vanilla installs of both Maven 2.2.1 and 3.0.3
  • Had a friend build the test project on his computer to rule out local problems on my computer
  • Changed the version from 4.1.1 to 4.1

For what it's worth I had the same problem a few days ago with org.easytesting.fest-swing, see pom dependency entry below:

<dependency>
    <groupId>org.easytesting</groupId>
    <artifactId>fest-swing</artifactId>
    <version>1.2.1</version>
</dependency>

2 Answers 2

31

You don't want httpcomponents-client as a dependency. That's just the parent pom for the client-related modules. I suspect you actually want <artifactId>httpclient</artifactId>.

4
  • Yes, that did indeed solve my problem. Thank you very much :) Commented Apr 3, 2011 at 20:18
  • 1
    +10 if I could... I was using the maven dependency provided by search.maven.org and had the same problem. I removed 'components-' from the core and client artifact IDs, and then I was able to get the jars I needed! Thanks again!
    – bakoyaro
    Commented Mar 14, 2013 at 18:23
  • 1
    Whoever wrote these artifact names must've also been the person responsible for PHP's naming standards
    – Ali
    Commented Aug 19, 2015 at 19:11
  • I spent 3h trying to fix this. Thank you! Commented Aug 27, 2019 at 14:12
0

Here a simple solution... Its great for me... You can downloar jar file from internet and add manually to project from netbeans or another IDE. Here an example for you: enter image description here

Search the downloaded jar in your computer enter image description here

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.