通過控制檯(Windows上的v0.13.1)運行sbt test
當我嘗試創建com.sun.rowset.CachedRowSetImpl
對象的實例時拋出MissingResourceException: : Can't find bundle for base name com/sun/rowset/RowSetResourceBundle, locale en_CA
。如果我使用IntelliJ來運行Specs測試,那麼相同的代碼運行得非常好;它只在嘗試通過SBT控制檯運行時失敗。MissingResourceException:找不到基本名稱的包com/sun/rowset/RowSetResourceBundle(SBT項目)
這裏是specs2測試我試圖運行:
import org.specs2.mutable.SpecificationWithJUnit
import javax.sql.rowset.CachedRowSet;
import com.sun.rowset.CachedRowSetImpl
class DatabaseTest extends SpecificationWithJUnit {
"CachedRowSet Test" should {
"Create a new CachedRowSetImpl instance" in {
val rowSet: CachedRowSet = new CachedRowSetImpl()
rowSet must_!= null
}
}
}
而由此導致的異常:
[error] MissingResourceException: : Can't find bundle for base name com/sun/rowset/RowSetResourceBundle, locale en_CA (null:-1)
[error] com.sun.rowset.JdbcRowSetResourceBundle.<init>(Unknown Source)
[error] com.sun.rowset.JdbcRowSetResourceBundle.getJdbcRowSetResourceBundle(Unknown Source)
[error] com.sun.rowset.CachedRowSetImpl.<init>(Unknown Source)
[error] test.DatabaseTest$$anonfun$1$$anonfun$apply$1.apply(DatabaseTest.scala:10)
[error] test.DatabaseTest$$anonfun$1$$anonfun$apply$1.apply(DatabaseTest.scala:9)
更新:build.sbt
內容:
scalacOptions ++= Seq("-deprecation", "-unchecked", "-feature")
scalaVersion := "2.10.3"
scalacOptions ++= Seq("-Yrangepos")
javacOptions ++= Seq("-source", "1.6", "-target", "1.6", "-Xlint:deprecation", "-Xlint:unchecked")
libraryDependencies in ThisBuild ++= Seq(
"postgresql" % "postgresql" % "9.1-901.jdbc4" withSources(),
"org.specs2" %% "specs2" % "2.3.7" withSources()
)
lazy val root = project.in(file("."))
如何構建配置的樣子 - 'build.sbt'或'project/*。scala'文件?如果你更新這個問題會很好。 –