Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Unit testing 圣杯&x2B;Intellijj+;斯波克_Unit Testing_Grails_Intellij Idea_Groovy_Spock - Fatal编程技术网

Unit testing 圣杯&x2B;Intellijj+;斯波克

Unit testing 圣杯&x2B;Intellijj+;斯波克,unit-testing,grails,intellij-idea,groovy,spock,Unit Testing,Grails,Intellij Idea,Groovy,Spock,我正在使用spock为grails应用程序控制器编写一些单元测试。当我运行规范时,我得到以下错误。 所有这些错误都出现在.java文件中。我是grails和spock的新手。任何帮助都将不胜感激。 我使用的是JDK1.8、Grails2.4.3 Error:(14, 10) java: annotations are not supported in -source 1.3 (use -source 5 or higher to enable annotations) Error:(14,

我正在使用spock为grails应用程序控制器编写一些单元测试。当我运行规范时,我得到以下错误。 所有这些错误都出现在.java文件中。我是grails和spock的新手。任何帮助都将不胜感激。
我使用的是JDK1.8、Grails2.4.3

Error:(14, 10) java: annotations are not supported in -source 1.3
  (use -source 5 or higher to enable annotations)

Error:(14, 10) java: annotations are not supported in -source 1.3
  (use -source 5 or higher to enable annotations)

Error:(14, 10) java: annotations are not supported in -source 1.3
  (use -source 5 or higher to enable annotations)
Error:(34, 23) java: generics are not supported in -source 1.3
  (use -source 5 or higher to enable generics)
Error:(79, 31) java: enhanced for loops are not supported in -source 1.3
  (use -source 5 or higher to enable for-each loops)
Error:(133, 41) java: ';' expected

Error:(171, 9) java: illegal start of expression

您使用的JDK版本是什么?您必须至少使用JDK 6+。您是否还在.java文件中编写groovy语法代码?我使用的是jdk 1.8、grails 2.4.3您必须在IntelliJ中显式地将项目jdk设置为使用1.8.Ok。我在“项目结构”对话框中将语言级别更改为8。这有助于消除错误。但我没有得到另一个错误。它给我找不到类:MyTestClassControllerSpec您正在使用的JDK版本是什么?您必须至少使用JDK 6+。您是否还在.java文件中编写groovy语法代码?我使用的是jdk 1.8、grails 2.4.3您必须在IntelliJ中显式地将项目jdk设置为使用1.8.Ok。我在“项目结构”对话框中将语言级别更改为8。这有助于消除错误。但我没有得到另一个错误。它给了我未找到的类:mytestclassControllerSpec