本文介绍了Eclipse中的ScalaTest:运行它会给出NullPointer异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编辑:此问题是sbteclipse的错误,并已

This issue was a bug with sbteclipse and has been fixed

当我右键单击ScalaTest套件并选择Run as ScalaTest File,我得到一个NullPointer异常。

When I right click on a ScalaTest suite and select Run as ScalaTest File, I get a NullPointer Exception.


  • 作为插件,我有Scala IDE的ScalaTest 2.9.3.v-3-2_09-201309130843-55f5c32

  • 作为我的库中的jar,我有scalatest_2。 9.0-2.0.M5b.jar(尝试使用scalatest_2.9.3-RC2-2.0.M5b.jar)

  • 测试运行在SBT

侧面问题:如果它是jar和插件之间的Scalatest兼容性问题,我该如何获得与插件匹配的适当的jar?
我在这里查看,但我不知道要选择哪一个。

Side Question: If it is a Scalatest compatibility issue between the jar and the plugin, how do I get the appropriate jar which matches the plugin?I looked here https://oss.sonatype.org/content/groups/public/org/scalatest/ but I don't know which one to pick.

其他详细信息:

eclipse.buildId=M20120208-0800
java.version=1.7.0_40
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_CA
Framework arguments:  -product org.eclipse.epp.package.jee.product
Command-line arguments:  -os linux -ws gtk -arch x86 -product org.eclipse.epp.package.jee.product


推荐答案

为什么会发生这种情况:

如果您使用sbteclipse创建你的eclipse配置。 sbteclipse使用您的.ivy2文件夹中的Scala库,该文件夹可能与scalatest插件不兼容,因此出错。

The error can happen if you use sbteclipse to create your eclipse config. sbteclipse uses the Scala Library which in your .ivy2 folder which may not be compatible with the scalatest plugin, and hence the error.

头和沉思nuking我的电脑

What I learnt after breaking my head and contemplating nuking my PC

转到项目属性 - > Java构建路径 - >库
删除生成的scala库指向ivy
使用'添加库...'添加Scala-ide附带的Scala库,
[可选]确保运行配置也使用捆绑的Scala库。

Go to Project Properties -> Java Build Path -> LibrariesRemove the generated scala library pointing to ivyuse 'Add Library...' to add Scala Library that comes with the scala-ide,[Optional] make sure that the Run Configuration uses the bundled Scala Library also.

此解决方案由

这篇关于Eclipse中的ScalaTest:运行它会给出NullPointer异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-11 06:38