scalatest在idea和maven中執行錯誤的問題解決

方健發表於2014-11-07

參見http://www.scalatest.org/user_guide/running_your_tests
在idea中點選scalatest的測試執行出這個

java.lang.NoSuchMethodError: scala.runtime.ObjectRef.create(Ljava/lang/Object;)Lscala/runtime/ObjectRef;

原因是: scalatest和scala的版本不符

<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.10</artifactId>

這裡的scalatest是配合scala的2.10版本的 參見https://github.com/scalatest/scalatest/issues/373

執行mvn test 出現這個錯:已按照http://www.scalatest.org/user_guide/using_the_scalatest_maven_plugin 配置 java.lang.IncompatibleClassChangeError: Implementing class 也是版本不匹配造成的。 根據執行時的warning: scalatest_2.10要求的scala版本是2.10.4

相關文章