我想尝试使用geb / spock进行一些验收测试,并从下面的初始gradle构建脚本开始:
apply plugin: "groovy"
repositories {
mavenCentral()
}
configurations {
testCompile.transitive = true
}
dependencies {
groovy "org.codehaus.groovy:groovy-all:1.6.3"
def gebVersion = "0.6.2"
def seleniumVersion = "2.15.0"
// If using Spock, need to depend on geb-spock
testCompile "org.codehaus.geb:geb-spock:$gebVersion"
testCompile "org.spockframework:spock-core:0.5-groovy-1.7"
// If using JUnit, need to depend on geb-junit (3 or 4)
testCompile "org.codehaus.geb:geb-junit4:$gebVersion"
testCompile "junit:junit-dep:4.8.2"
// Need a driver implementation
testCompile "org.seleniumhq.selenium:selenium-chrome-driver:$seleniumVersion"
testRuntime "org.seleniumhq.selenium:selenium-support:$seleniumVersion"
}
test {
systemProperties "geb.build.reportsDir": "$reportsDir/geb"
}
当我尝试运行测试时,我的Windows机器上出现了最奇怪的错误,我不知道在谷歌搜索中没有看到任何人出现此错误:
失败:构建因异常而失败。
出了什么问题:任务'执行失败':compileTestGroovy'。
Forked groovyc返回错误代码:-1073741819
尝试:使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获得更多日志输出。
想知道是否有人知道我应该从哪里开始......
更新
将groovy更改为1.7.10
仍会导致相同的错误。下面是-s -d
选项
15:24:34.540 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':compileTestGroovy'
15:24:34.571 [ERROR] [org.gradle.BuildExceptionReporter]
15:24:34.571 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
15:24:34.587 [ERROR] [org.gradle.BuildExceptionReporter]
15:24:34.587 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
15:24:34.587 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':compileTestGroovy'.
15:24:34.602 [ERROR] [org.gradle.BuildExceptionReporter] > Forked groovyc returned error code: -1073741819
15:24:34.602 [ERROR] [org.gradle.BuildExceptionReporter]
15:24:34.618 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is:
15:24:34.618 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':compileTestGroovy'.
15:24:34.634 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteAct
ionsTaskExecuter.java:68)
15:24:34.634 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTas
kExecuter.java:46)
15:24:34.649 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecut
ionAnalysisTaskExecuter.java:34)
15:24:34.649 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.changedetection.CacheLockHandlingTaskExecuter$1.run(CacheLockHandlin
gTaskExecuter.java:34)
15:24:34.665 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultCacheAccess$2.create(DefaultCacheAccess.java:200)
15:24:34.665 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:17
2)
15:24:34.681 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:19
8)
15:24:34.681 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultPersistentDirectoryStore.longRunningOperation(DefaultPersis
tentDirectoryStore.java:111)
15:24:34.696 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateCacheAccess.longRunningOpera
tion(DefaultTaskArtifactStateCacheAccess.java:83)
15:24:34.696 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.changedetection.CacheLockHandlingTaskExecuter.execute(CacheLockHandl
ingTaskExecuter.java:32)
15:24:34.712 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExe
cuter.java:55)
15:24:34.727 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecute
r.java:57)
15:24:34.727 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySo
urceFilesTaskExecuter.java:41)
15:24:34.743 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNo
ActionsExecuter.java:51)
15:24:34.743 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecute
r.java:52)
15:24:34.759 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostO
nceTaskExecuter.java:42)
15:24:34.759 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:250
)
15:24:34.774 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultTaskGraphExecuter.executeTask(DefaultTaskGraphExecuter.java:192)
15:24:34.774 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultTaskGraphExecuter.doExecute(DefaultTaskGraphExecuter.java:177)
15:24:34.790 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:83)
15:24:34.821 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:36
)
15:24:34.868 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
15:24:34.868 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
15:24:34.884 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
15:24:34.884 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter$1.run(TaskCacheLo
ckHandlingBuildExecuter.java:31)
15:24:34.899 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultCacheAccess$1.create(DefaultCacheAccess.java:111)
15:24:34.899 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:126)
15:24:34.899 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:109)
15:24:34.915 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirector
yStore.java:103)
15:24:34.915 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateCacheAccess.useCache(Default
TaskArtifactStateCacheAccess.java:79)
15:24:34.931 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter.execute(TaskCache
LockHandlingBuildExecuter.java:29)
15:24:34.931 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
15:24:34.946 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
15:24:34.946 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
15:24:34.962 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
15:24:34.962 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
15:24:34.977 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54)
15:24:34.977 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:155
)
15:24:34.993 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:110)
15:24:34.993 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:78)
15:24:34.993 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:42)
15:24:35.009 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:28)
15:24:35.009 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:32)
15:24:35.024 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:21)
15:24:35.024 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$WithLoggingAction.execute(CommandLineAction
Factory.java:238)
15:24:35.040 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$WithLoggingAction.execute(CommandLineAction
Factory.java:222)
15:24:35.040 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.Main.doAction(Main.java:48)
15:24:35.056 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.EntryPoint$1.execute(EntryPoint.java:53)
15:24:35.056 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.EntryPoint$1.execute(EntryPoint.java:51)
15:24:35.056 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.Execution.execute(Execution.java:28)
15:24:35.071 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.EntryPoint.run(EntryPoint.java:39)
15:24:35.071 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.Main.main(Main.java:39)
15:24:35.087 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.ProcessBootstrap.runNoExit(ProcessBootstrap.java:51)
15:24:35.087 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.ProcessBootstrap.run(ProcessBootstrap.java:33)
15:24:35.087 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.GradleMain.main(GradleMain.java:24)
15:24:35.102 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: : Forked groovyc returned error code: -1073741819
15:24:35.102 [ERROR] [org.gradle.BuildExceptionReporter] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
15:24:35.118 [ERROR] [org.gradle.BuildExceptionReporter] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
15:24:35.118 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.ant.BasicAntBuilder.nodeCompleted(BasicAntBuilder.java:71)
15:24:35.134 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.AntBuilderDelegate.nodeCompleted(DefaultIsolatedAntBuilder.g
roovy:173)
15:24:35.134 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.compile.AntGroovyCompiler$_execute_closure1.doCall(AntGroovyCo
mpiler.groovy:60)
15:24:35.149 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:136)
15:24:35.149 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:85)
15:24:35.165 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.util.ConfigureUtil$configure.call(Unknown Source)
15:24:35.165 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.DefaultIsolatedAntBuilder.execute(DefaultIsolatedAntBuilder.
groovy:113)
15:24:35.165 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.IsolatedAntBuilder$execute.call(Unknown Source)
15:24:35.181 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.compile.AntGroovyCompiler.execute(AntGroovyCompiler.groovy:57)
15:24:35.181 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.compile.IncrementalJavaCompilerSupport.execute(IncrementalJava
CompilerSupport.java:42)
15:24:35.196 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.tasks.compile.GroovyCompile.compile(GroovyCompile.java:60)
15:24:35.196 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.ja
va:196)
15:24:35.212 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:102)
15:24:35.212 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:93)
15:24:35.227 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.tasks.compile.GroovyCompile_Decorated.invokeMethod(Unknown Source)
15:24:35.227 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.util.ReflectionUtil.invoke(ReflectionUtil.groovy:23)
15:24:35.243 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$4.execute(Annota
tionProcessingTaskFactory.java:150)
15:24:35.243 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$4.execute(Annota
tionProcessingTaskFactory.java:145)
15:24:35.259 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:495)
15:24:35.259 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:484)
15:24:35.274 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteAct
ionsTaskExecuter.java:60)
15:24:35.274 [ERROR] [org.gradle.BuildExceptionReporter] ... 54 more
15:24:35.290 [ERROR] [org.gradle.BuildExceptionReporter]
15:24:35.290 [LIFECYCLE] [org.gradle.BuildResultLogger]
15:24:35.290 [LIFECYCLE] [org.gradle.BuildResultLogger] BUILD FAILED
15:24:35.306 [LIFECYCLE] [org.gradle.BuildResultLogger]
15:24:35.306 [LIFECYCLE] [org.gradle.BuildResultLogger] Total time: 18.014 secs
答案 0 :(得分:2)
首先,spock-core:0.5-groovy-1.7不适用于Groovy 1.6。我建议改用1.7.10。此外,使用-s -d运行构建可能会提供线索。
答案 1 :(得分:1)
我一直面临着类似的问题(同样的例外)并解决了它为主类和测试类禁用groovyc forks(基于此链接http://forums.gradle.org/gradle/topics/gradle_m6_and_forked_groovyc_returned_error_code_1_when_using_spock)。
您可以在build.gradle
脚本中设置此内容。
compileGroovy.groovyOptions.fork = false
compileTestGroovy.groovyOptions.fork = false
注意(正如链接帖子中提到的那样):“但是,此模式还有其他限制。例如,Groovy编译器插件(因此Spock)显然不起作用。“
希望它有所帮助,
弗雷德里克