why ban commons-logging ?

2,885 views
Skip to first unread message

smallufo

unread,
Jan 17, 2014, 12:08:59 AM1/17/14
to ninja-f...@googlegroups.com
Recently , I added org.apache.httpcomponents - httpclient - 4.3.1 to pom.xml ,
and found I cannot run ninja , because of a banned dependency :

Found Banned Dependency: commons-logging:commons-logging:jar:1.1.3

I then found pom.xml has a plugin :
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>1.0</version>
        <executions>
          <execution>
            <id>enforce-banned-dependencies</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <bannedDependencies>
                  <excludes>
                    <exclude>commons-logging</exclude>
                  </excludes>
                </bannedDependencies>
              </rules>
              <fail>true</fail>
            </configuration>
          </execution>
        </executions>
      </plugin>

that banned commons-logging .

Why ?

Why banned commons-logging ? Is it doing anything wrong ?

And if I want to use httpclient , what should I do ?

Thanks.

Raphael André Bauer

unread,
Jan 17, 2014, 3:48:46 AM1/17/14
to ninja-f...@googlegroups.com
Hi smallufo,


Ninja uses slf4j (logging facade) and logback (implementation) for
logging. If you'd put another logging implementation or logging facade
on the classpath things will go wrong (or you'd have to manage at
least two logging configurations...).

Therefore there it makes sense that Maven warns you about banned dependencies.

Fortunately the fix is really simple - exclude commons-logging from
the dependency you are including.

for instance:
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.2.1</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency>

That way slf4j will overtake logging and you can configure logging via
logback.xml.

You can see more how to configure stuff in one of Ninja's main files:
https://github.com/ninjaframework/ninja/blob/develop/pom.xml

more about logback and legacy Apis:
http://www.slf4j.org/legacy.html


Cheers,


Raphael
> --
> You received this message because you are subscribed to the Google Groups
> "ninja-framework" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ninja-framewo...@googlegroups.com.
> To post to this group, send email to ninja-f...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ninja-framework/CAKJWkkHnLZBJXWxUzM_8dCDc5KfYekhfJ9yE0eqE5F-9ijOSzw%40mail.gmail.com.
> For more options, visit https://groups.google.com/groups/opt_out.



--
inc: http://ars-machina.raphaelbauer.com
tech: http://ars-codia.raphaelbauer.com
web: http://raphaelbauer.com
Reply all
Reply to author
Forward
0 new messages