我正在尝试启动由maven生成的groovy简单原型的测试:
mvn archetype:generate
-DarchetypeGroupId=org.codehaus.gmaven.archetypes
-DarchetypeArtifactId=gmaven-archetype-basic -DarchetypeVersion=1.3但是当我在src/test/groovy/fr/xlim/ssd/fuzzer/ExampleTest.groovy中启动src/test/groovy/fr/xlim/ssd/fuzzer/ExampleTest.groovy时
import Example
package fr.xlim.ssd.fuzzer
class ExampleTest extends GroovyTestCase
{
void testShow() {
assert true
new Example().show()
}
}我有以下错误:
unexpected token: package - file:/home/kartoch/works/groovy/fuzzer
/src/test/groovy/fr/xlim/ssd/fuzzer/ExampleTest.groovy[3:1]即使测试文件位于正确的目录中,groovy编译器似乎也无法识别package关键字。
有什么想法吗?可能是Groovy中的语法更改(我使用的是Groovy1.7)?
注意:此错误可能与maven无关
发布于 2011-05-03 14:48:37
将您的导入移到包行下面,就像在Java中一样。
https://stackoverflow.com/questions/5871285
复制相似问题