我无法解析我的sbt项目中的LOG4j对scala的依赖关系。我有一个maven项目,它具有相同的依赖关系和相同的scala版本,并且运行良好。这是我的build.sbt
scalaVersion := "2.11.8"
libraryDependencies += "org.apache.logging.log4j" %% "log4j-core" % "2.7"
libraryDependencies += "org.scalactic" %% "scalactic" % "3.0.1"
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1" % "test"
这是IntelliJ显示的错误
Error:Error while importing SBT project:<br/>...<br/><pre>[info] Resolving org.scala-sbt#template-resolver;0.1 ...
[info] Resolving org.scala-tools.sbinary#sbinary_2.10;0.4.2 ...
[info] Resolving org.scala-sbt#api;0.13.13 ...
[info] Resolving org.scala-sbt#incremental-compiler;0.13.13 ...
[info] Resolving org.scala-sbt#apply-macro;0.13.13 ...
[info] Resolving org.spire-math#json4s-support_2.10;0.6.0 ...
[info] Resolving com.thoughtworks.paranamer#paranamer;2.6 ...
[info] Resolving org.scala-sbt#test-agent;0.13.13 ...
[info] Resolving org.scala-sbt#classfile;0.13.13 ...
[info] Resolving org.scala-sbt#completion;0.13.13 ...
[info] Resolving org.scala-sbt#test-interface;1.0 ...
[info] Resolving com.jcraft#jsch;0.1.50 ...
[info] Resolving org.scala-lang#scala-compiler;2.10.6 ...
[info] Resolving org.scala-sbt#interface;0.13.13 ...
[info] Resolving org.scala-sbt#logging;0.13.13 ...
[trace] Stack trace suppressed: run 'last *:update' for the full output.
[trace] Stack trace suppressed: run 'last *:ssExtractDependencies' for the full output.
[error] (*:update) sbt.ResolveException: unresolved dependency: org.apache.logging.log4j#log4j-core_2.11;2.7: not found
[error] (*:ssExtractDependencies) sbt.ResolveException: unresolved dependency: org.apache.logging.log4j#log4j-core_2.11;2.7: not found
[error] Total time: 5 s, completed Feb 20, 2017 11:24:48 AM</pre><br/>See complete log in <a href="/Users/salvob/Library/Logs/IdeaIC2016.3/sbt.last.log">/Users/salvob/Library/Logs/IdeaIC2016.3/sbt.last.log</a> enter code here
2条答案
按热度按时间5q4ezhmt1#
只需在log4j依赖关系中将
%%
替换为%
,使其变为有关说明,请参见Build.scala, % and %% symbols meaning。
因为log4j是java库,所以它不包含工件坐标中的scala版本。
llycmphe2#
在log4j的新更新中,由于log4j零日漏洞,建议的代码如下所示: