我试图使用gmaven插件编译src/test/groovy/com/kc/Validator.groovy中的类com.kc.Validator,然后使用该类运行脚本。在mvn compile之后,.class文件在*.class/test-.class/com/kc中,但是脚本执行失败:
Failed to execute goal org.codehaus.gmaven:gmaven-plugin:1.5:execute (validate-configuration) on project solver2: startup failed, script1367530828433.groovy: 1: unable to resolve class com.kc.Validatorpom.xml的相关部分是:
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>compile-groovy</id>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
<execution>
<id>validate</id>
<phase>test</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<source>
(new com.kc.Validator()).validate()
</source>
</configuration>
</execution>
</executions>
</plugin>发布于 2013-05-03 18:55:12
你试过在<configuration>里面使用<configuration>吗?
<configuration>
<scriptpath>
<element>${pom.basedir}/src/test/groovy/com/kc</element>
</scriptpath>
<source>......</souce>
</configuration>请参考使用Groovy类。
https://stackoverflow.com/questions/16348582
复制相似问题