The dependencies in the maven pom.xml should include a compile-scope dependency on slf4j-api and an optional dependency on slf4j-nop:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.5.6</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<version>1.5.6</version>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
This way maven users won't have to explicitly exclude the slf4j-nop dependency, since they're almost definitely using one of the real implementations (log4j, etc).
Interestingly, even though the dependency on slf4j-api is there, it's not showing up when I run "mvn dependency:tree":
[INFO] +- org.dbunit:dbunit:jar:2.4.1:compile
[INFO] | +- commons-collections:commons-collections:jar:3.2.1:compile
[INFO] | \- org.slf4j:slf4j-nop:jar:1.5.6:runtime
There should be one more dependency listed there: org.slf4j:slf4j-api.
Hi there,
my dependency-tree looks as follows and the slf4j-api dependency looks nice:
[INFO] [dependency:tree]
[INFO] org.dbunit:dbunit:jar:2.4.2-SNAPSHOT
[INFO] +- junit:junit:jar:3.8.2:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.5.6:compile
[INFO] +- commons-collections:commons-collections:jar:3.2.1:compile
[INFO] +- ant:ant:jar:1.5.4:compile
[INFO] +- org.apache.poi:poi:jar:3.2-FINAL:compile
[INFO] | \- commons-logging:commons-logging:jar:1.1:compile
[INFO] | \- log4j:log4j:jar:1.2.13:compile
[INFO] +- junit-addons:junit-addons:jar:1.4:test
[INFO] | +- xerces:xercesImpl:jar:2.6.2:test
[INFO] | \- xerces:xmlParserAPIs:jar:2.6.2:test
[INFO] +- mockobjects:mockobjects-core:jar:0.07:test
[INFO] +- mockmaker:mmmockobjects:jar:1.12.0:test
[INFO] +- mockobjects:mockobjects-jdk1.3:jar:0.07:test
[INFO] +- hsqldb:hsqldb:jar:1.8.0.1:test
[INFO] +- org.apache.derby:derby:jar:10.4.1.3:test
[INFO] +- gsbase:gsbase:jar:2.0.1:test
[INFO] | \- junitperf:junitperf:jar:1.8:test
[INFO] \- org.slf4j:slf4j-nop:jar:1.5.6:runtime
Am I doing anything wrong here?
Regards,
mat
I committed the "optional" for the slf4j-nop.jar now (svn rev 916/trunk). For the "slf4j-api.jar" I do not know/understand what is wrong.
Best regards,
mat
Mat,
Thanks for adding the optional element for slf4j-nop.
With respect to slf4j-api, I think you got it. I was misinterpreting something on my end; there was no problem.
Cheers,
Christian
Hi Christian,
thanks for your contribution. I am setting this tracker item to closed/fixed.
Regards,
mat