peter
peter

Reputation: 61

How to use httpclient 4.1.x with Maven

httpclient version 4.0 works in my pom.xml:

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

...but versions > 4.0 don't compile:

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

The error:

[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).


Project ID: unknown:httpclient

Reason: Parent: null:httpmime:jar:null of project: unknown:httpclient has wrong
packaging: jar. Must be 'pom'. for project unknown:httpclient

Any idea how to use httpclient 4.1 with Maven?

Upvotes: 2

Views: 25246

Answers (3)

Yilmaz Guleryuz
Yilmaz Guleryuz

Reputation: 9745

confirmed, use Maven 3.0.x and it works! here is example from working pom.xml

<dependencies>
    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>2.4</version>
    </dependency>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.3.2</version>
    </dependency>
</dependencies>

Upvotes: 6

peter
peter

Reputation: 1

It was a Maven issue: Using Maven 3.0.3 instead of 2.2.1 solved the problem.

Upvotes: 0

Abhishek Gayakwad
Abhishek Gayakwad

Reputation: 582

I just tried same configurations jar got downloaded from following location which is one of default repos

http://repo1.maven.org/maven2/org/apache/httpcomponents/httpcomponents-client/4.1

Just try after mentioning http://repo1.maven.org/maven2 explicitly in your pom file and try using command line

and apache http client 4.1.1 version is also available now

Upvotes: 0

Related Questions