2016-07-06 149 views
1

當我嘗試運行(通過SBT)我的scala程序時,遇到了一堆錯誤。無法編譯scala/SBT項目

下面是摘錄:

[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.) 

..... 

我做的斯卡拉,library.jar添加到類路徑,但無濟於事。有誰知道可能會丟失什麼?

Ps。使用 - 在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方法)......其更改爲對象的事情後,工作好了很多:)

編輯3:

輪輻太快。我發現它與在build.sbt中設置scalaVersion有關。當我將整條線路全部留出時,它不再抱怨缺失的依賴關係。當我把它放回去時,我得到了上面提到的錯誤。我試着將其設置爲2.11.7(在安裝了brew install scala之後),但無濟於事。

+0

你能編輯你的文章並添加你的'build.sbt'文件嗎? – meucaa

+0

您選擇了哪些版本的SDK,SBT和Scala? –

+0

根據要求更新 – JHuys

回答

1
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" %某些版本,它將查找scales-xml_2.11。見http://www.scala-sbt.org/0.13/docs/Cross-Build.html

+0

謝謝,那是我錯過了:) – JHuys