IDEA中的scalatest编译出错 [英] Error on scalatest compilation in IDEA

查看:301
本文介绍了IDEA中的scalatest编译出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编译包含scalatest的Scala项目。
它在sbt上编译正常

I am trying to compile Scala project which contains scalatest. It compiles normal on sbt

sbt
> compile
> test:compile

,但是当我尝试使用IDEA构建它时,它显示以下错误:

, but when I am trying to build it with IDEA, it shows the following error:

Error:(37, 11) exception during macro expansion: 
java.lang.NoSuchMethodError: org.scalactic.BooleanMacro.genMacro(Lscala/reflect/api/Exprs$Expr;Ljava/lang/String;Lscala/reflect/api/Exprs$Expr;)Lscala/reflect/api/Exprs$Expr;
at org.scalatest.AssertionsMacro$.assert(AssertionsMacro.scala:34)
assert((ElementMeasures.baseElementDistance(mEl1, mEl2) - 0.33333).abs < 0.001)
      ^

测试中每个断言函数的

for each assert function in test.

build.sbt 文件包含以下内容:

name := "ner-scala"
organization := "ml.generall"
version := "1.0-SNAPSHOT"
scalaVersion := "2.11.8"
libraryDependencies += "org.scalactic" %% "scalactic" % "3.0.0"
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.0" % "test"
...


推荐答案

它也可能意味着你有多个版本的scalatest注册。我遇到了与assert

It may also mean that you have more than one versions of scalatest registered. I came into pretty same issue with compile-time error on assert

这篇关于IDEA中的scalatest编译出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆