当我尝试运行(通过SBT)我的scala程序时,我遇到了很多错误。
摘录如下:
[error] missing or invalid dependency detected while loading class file 'IterableUtils.class'.
[error] Could not access type ScalaObject in package scala,
[error] because it (or its dependencies) are missing. Check your build definition for
[error] missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
[error] A full rebuild may help if 'IterableUtils.class' was compiled against an incompatible version of scala.
[error] missing or invalid dependency detected while loading class file 'AsBooleanTrait.class'.
[error] Could not access type ScalaObject in package scala,
[error] because it (or its dependencies) are missing. Check your build definition for
[error] missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
.....
我确实将scala-library.jar添加到类路径中,但无济于事。有谁知道可能会丢失什么?
附言 二手-> OSX上的新SBT项目(Intellij)
编辑:这是build.sbt
name := "test"
version := "1.0"
scalaVersion := "2.11.8"
resolvers += "Scales XML" at "https://mvnrepository.com/artifact/org.scalesxml/scales-xml_2.9.1"
libraryDependencies += "org.scalesxml" % "scales-xml_2.9.1" % "0.3-RC7"
SBT版本为0.13.8
编辑2:
弄清楚了。我试图在不创建实例的情况下运行类(使用main方法)...将其更改为Object后,效果会更好:)
编辑3:
发言时间过早。我发现这与在build.sbt中设置scalaVersion有关。当我把整条线留在外面时,它不再抱怨缺少依赖项。当我把它放回去时,我得到了上面提到的错误。我也尝试将其设置为2.11.7(用brew install scala安装后),但无济于事。
scalaVersion := "2.11.8" libraryDependencies += "org.scalesxml" % "scales-xml_2.9.1" % "0.3-RC7"
您不能将针对Scala 2.9.1编译的库与Scala 2.11。*一起使用。改写"org.scalesxml" %% "scales-xml" %
some-version,它将寻找scales-xml_2.11
。参见http://www.scala-sbt.org/0.13/docs/Cross-Build.html。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句