编译项目时错误迁移到SBT - 加载包和断言时出错

时间:2014-03-09 12:52:36

标签: scala sbt

我正在迁移Scala应用程序,该应用程序通过手动编译和运行 包括类路径中的jar到SBT构建配置。

我的build.sbt如下:

name := "hello"

version := "1.0"

scalaVersion := "2.9.2"

libraryDependencies += "org.slf4j" % "slf4j-simple" % "1.6.4"

libraryDependencies += "junit" % "junit" % "4.11"

libraryDependencies += "org.scalatest" % "scalatest_2.10" % "1.9.2"

libraryDependencies += "org.hamcrest" % "hamcrest-all" % "1.3"

libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.0.13"

libraryDependencies += "com.github.scct" % "scct_2.10" % "0.2.1"

libraryDependencies += "org.scala-lang" % "scala-swing" % "2.9.2"

当我编译它时,我得到以下错误:

Loading /usr/share/sbt/bin/sbt-launch-lib.bash
[info] Set current project to hello (in build file:/home/kevin/gitrepos/go-game-msc/)
> compile
[info] Updating {file:/home/kevin/gitrepos/go-game-msc/}go-game-msc...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Compiling 25 Scala sources to /home/kevin/gitrepos/go-game-msc/target/scala-2.9.2/classes...
[error] error while loading package, class file needed by package is missing.
[error] reference value <init>$default$2 of object deprecated refers to nonexisting symbol.
[error] error while loading Assertions, class file needed by Assertions is missing.
[error] reference value <init>$default$2 of object deprecated refers to nonexisting symbol.
[error] two errors found
[error] (compile:compile) Compilation failed
[error] Total time: 21 s, completed 09-Mar-2014 12:07:14

我尝试将依赖项与我正在使用的jar文件进行匹配:

hamcrest-all-1.3.jar   
logback-classic-1.0.13.jar  
scalaedit-assembly-0.3.7(1).jar  
scalatest_2.9.0-1.9.1.jar    
slf4j-simple-1.6.4.jar
hamcrest-core-1.3.jar  
logback-core-1.0.13.jar     
scalaedit-assembly-0.3.7.jar     
scct_2.9.2-0.2-SNAPSHOT.jar
junit-4.11.jar         
miglayout-4.0.jar           
scalariform.jar                  
slf4j-api-1.7.5.jar

请告知。

1 个答案:

答案 0 :(得分:0)

永远不要混合使用scala二进制版本。 始终使用%%(而不是%和_2.x.x):

libraryDependencies +="org.scalatest" %% "scalatest" % "1.9.2"

libraryDependencies +="com.github.scct" %% "scct" % "0.2-SNAPSHOT"