Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use Apache HTTPClient without Commons-logging.jar

I'm trying to user Apache HTTPClient in my project. Here does not required any logging for this application. So Can I use HTTPClient without Commons-logging.jar. Otherwise it will be a extra unnecessary burden for my distribution package.

like image 214
Nayana Adassuriya Avatar asked Feb 05 '14 05:02

Nayana Adassuriya


1 Answers

Yes you can. As Hannes suggested - here is my own HttpClient maven setup:

<dependency>
    <groupId>org.apache.httpcomponents</groupId>
    <artifactId>httpclient</artifactId>
    <version>4.3.1</version>
    <exclusions>
        <exclusion>
            <artifactId>commons-logging</artifactId>
            <groupId>commons-logging</groupId>
        </exclusion>
    </exclusions>
</dependency>

Next, since common-logging is indeed a runtime dependency, you will need to define the SLF4J bridge for commons-logging:

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>jcl-over-slf4j</artifactId>
    <version>1.7.5</version>
</dependency>

And finally, you will of course need to have a valid SLF4J configuration - here is mine:

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <version>1.7.5</version>
</dependency>
<dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-classic</artifactId>
    <version>1.0.11</version>
</dependency>

Hope this helps.

like image 91
Eugen Avatar answered Oct 25 '22 15:10

Eugen