sbt运行时classPath与compile classPath不匹配,导致java.lang.NoClassDefFoundError

时间:2015-11-09 22:50:50

标签: scala sbt

运行时类路径根据' show runtime:fullClasspath'仅包含target / scala-2.11 / classes和〜/ .ivy2 / cache / org.scala-lang / scala-library / jars / scala-library-2.11.7.jar。 compile:fullClasspath包含〜/ .ivy2 / cache下的所有libraryDependencies jar位置。为什么是这样?我在sbt run上获得了java.lang.NoClassDefFoundError。

build.sbt:

name := "my-server"

version := "1.0"

scalaVersion := "2.11.7"

libraryDependencies ++= List(
  "com.typesafe.slick" %% "slick" % "3.1.0" % "provided",
  "com.twitter.finatra" %% "finatra-http" % "2.1.0" % "provided",
  "com.roundeights" %% "hasher" % "1.2.0" % "provided",
  "com.twitter" %% "util-logging" % "6.29.0" % "provided"
)

resolvers +=
  "Twitter" at "http://maven.twttr.com"

resolvers ++= Seq("RoundEights" at "http://maven.spikemark.net/roundeights")

sbt run results:

Exception in thread "main" java.lang.NoClassDefFoundError: com/twitter/logging/Logger

版本0.13.8

1 个答案:

答案 0 :(得分:0)

删除"提供"是修复这里 - 我错误地使用它来解决依赖关系的模糊颠覆(从freenode #scala归功于pfn)