如何从 scala/sbt/slf4j 项目中排除公共日志记录?

编程入门 行业动态 更新时间:2024-10-24 19:24:43
本文介绍了如何从 scala/sbt/slf4j 项目中排除公共日志记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我的 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 项目中排除公共日志记录?

本文发布于:2023-11-25 04:00:37,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1628235.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:项目   日志   scala   sbt   slf4j

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!