Java – I can do it without commons logging Using Apache httpclient in the case of jar
•
Java
I'm trying to use Apache http client.asp in my project No logging for this application is required here So I can do it without commons logging Using HTTP client. Jar Otherwise, it will create an additional unnecessary burden on my distribution package
Solution
Yes, you can As Hannes said – this is my own httpclient Maven setting:
<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 need to define an slf4j bridge for common logging:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.7.5</version>
</dependency>
Finally, of course, you need to have a valid slf4j configuration – this is my:
<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>
I hope this will help
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码
