我在grails中编写一个GANT脚本,首先运行单元测试用例,然后运行if单元测试用例。
我的脚本是
includeTargets << grailsScript("_GrailsInit")
includeTargets << grailsScript("_GrailsSettings")
includeTargets << grailsScript("_GrailsClean")
includeTargets << grailsScript("_GrailsTest")
includeTargets << grailsScript("_GrailsRun")
import org.codehaus.groovy.grails.cli.GrailsScriptRunner as GSR
//includeTargets << new File ( "${grailsHome}/scripts/RunApp.groovy" )
/*target(customRun: "The description of the script goes here!") {
// TODO: Implement script here
depends(checkVersion, configureProxy, parseArguments, cleanTestReports)
runApp()
//runApp()
}*/
target(customRun: "The description of the script goes here!") {
// TODO: Implement script here
depends(checkVersion, configureProxy, parseArguments, cleanTestReports)
System.setProperty("grails.env", "test")
allTests()
System.setProperty("grails.env", "development")
runApp()
}
setDefaultTarget(customRun)
但是一旦生成测试报告,我就会收到scriptException。我不确定我的剧本中有什么问题。
例外是
Error |
org.codehaus.groovy.grails.cli.ScriptExitException
Error |
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
Error |
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
Error |
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
Error |
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
Error |
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
Error |
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
Error |
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:194)
Error |
at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:391)
Error |
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Error |
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
Error |
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Error |
at java.lang.reflect.Method.invoke(Method.java:606)
Error |
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:207)
Error |
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:68)
Error |
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
Error |
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
Error |
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Error |
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
Error |
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Error |
at java.lang.reflect.Method.invoke(Method.java:606)
Error |
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSite.invoke(PogoMetaMethodSite.java:166)
Error |
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:56)
Error |
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
Error |
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
Error |
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Error |
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
Error |
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Error |
at java.lang.reflect.Method.invoke(Method.java:606)
Error |
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:207)
Error |
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:68)
Error |
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
Error |
at gant.Gant.withBuildListeners(Gant.groovy:427)
Error |
at gant.Gant.this$2$withBuildListeners(Gant.groovy)
Error |
at gant.Gant$this$2$withBuildListeners$0.callCurrent(Unknown Source)
Error |
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49)
Error |
at gant.Gant$this$2$withBuildListeners$0.callCurrent(Unknown Source)
Error |
at gant.Gant.dispatch(Gant.groovy:415)
Error |
at gant.Gant.this$2$dispatch(Gant.groovy)
Error |
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Error |
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
Error |
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Error |
at java.lang.reflect.Method.invoke(Method.java:606)
Error |
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
Error |
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
Error |
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1085)
Error |
at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
Error |
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909)
Error |
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:732)
Error |
at gant.Gant.invokeMethod(Gant.groovy)
Error |
at groovy.lang.GroovyObject$invokeMethod.callCurrent(Unknown Source)
Error |
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49)
Error |
at groovy.lang.GroovyObject$invokeMethod.callCurrent(Unknown Source)
Error |
at gant.Gant.executeTargets(Gant.groovy:591)
Error |
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Error |
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
Error |
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Error |
at java.lang.reflect.Method.invoke(Method.java:606)
Error |
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSite.invoke(PogoMetaMethodSite.java:166)
Error |
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:56)
Error |
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49)
Error |
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:61)