我无法在我的sbt项目中为scala解析LOG4j的依赖关系。
我有一个具有相同依赖关系和相同scala版本的maven项目,它运行良好。
这是我的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
答案 0 :(得分:0)
只需将%%
替换为log4j依赖关系中的%
,以便它变为
libraryDependencies += "org.apache.logging.log4j" % "log4j-core" % "2.7"
请参阅Build.scala, % and %% symbols meaning了解相关信息。
由于log4j是java库,因此它不包含工件坐标中的scala版本。