我的 scala/sbt 项目使用 grizzled-slf4j 和 logback.第三方依赖项使用 Apache Commons Logging.
My scala/sbt project uses grizzled-slf4j and logback. A third-party dependency uses Apache Commons Logging.
对于 Java/Maven,我会使用 jcl-over-slf4j 和 logback-classic,这样我就可以使用 logback 作为统一的日志记录后端.
With Java/Maven, I would use jcl-over-slf4j and logback-classic so that I can use logback as the unified logging backend.
我还将消除第三方库让 sbt 引入的 commons-logging 依赖项.我在 Maven 中执行以下操作(www.slf4j/faq.html# excludeJCL):
I would also eliminate the commons-logging dependency that the third-party lib would let sbt pull in. I do the following in Maven (which is recommended by www.slf4j/faq.html#excludingJCL):
<dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> <version>1.1.1</version> <scope>provided</scope> </dependency>问题是,如何对 sbt 做同样的事情?
And the question is, how to do the same with sbt?
推荐答案Heiko 的方法可能会奏效,但不会导致第三方库的任何依赖项都无法下载.如果您只想排除特定的一项,请使用 exclude.
Heiko's approach will probably work, but will lead to none of the dependencies of the 3rd party lib to be downloaded. If you only want to exclude a specific one use exclude.
libraryDependencies += "foo" % "bar" % "0.7.0" exclude("org.baz", "bam")或
... excludeAll( ExclusionRule(organization = "org.baz") ) // does not work with generated poms!更多推荐
如何从 scala/sbt/slf4j 项目中排除公共日志记录?
发布评论