So I am trying build a simple gradle app and when I run it, I getting
geb.ConfigurationLoader$UnableToLoadException: Unable to load configuration @ 'file:/Users/john/Development/groovy/gradlegebautomation/build/resources/test/GebConfig.groovy' (with environment: null)
at geb.ConfigurationLoader.loadRawConfig(ConfigurationLoader.groovy:297)
at geb.ConfigurationLoader.loadRawConfig(ConfigurationLoader.groovy:281)
at geb.ConfigurationLoader.getConf(ConfigurationLoader.groovy:161)
at geb.ConfigurationLoader.doGetConf(ConfigurationLoader.groovy:139)
at geb.ConfigurationLoader.getConf(ConfigurationLoader.groovy:95)
at geb.ConfigurationLoader.getConf(ConfigurationLoader.groovy:114)
at geb.spock.GebSpec.createConf(GebSpec.groovy:29)
at geb.spock.GebSpec.createBrowser(GebSpec.groovy:33)
at geb.spock.GebSpec.getBrowser(GebSpec.groovy:38)
at geb.spock.GebSpec.methodMissing(GebSpec.groovy:51)
at geb.spock.GebReportingSpec.setupSpec(GebReportingSpec.groovy:30)
Caused by: java.lang.NoClassDefFoundError: org/apache/ivy/core/report/ResolveReport
at java.lang.Class.privateGetDeclaredMethods(Class.java:2436)
at java.lang.Class.getDeclaredMethods(Class.java:1793)
at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46)
at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33)
at groovy.grape.GrapeIvy.<init>(GrapeIvy.groovy:75)
at java.lang.Class.newInstance0(Class.java:357)
at java.lang.Class.newInstance(Class.java:310)
at groovy.grape.Grape.getInstance(Grape.java:101)
at groovy.grape.Grape.grab(Grape.java:136)
at groovy.grape.GrabAnnotationTransformation.visit(GrabAnnotationTransformation.java:291)
at org.codehaus.groovy.transform.ASTTransformationVisitor$3.call(ASTTransformationVisitor.java:319)
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:903)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:566)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:542)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:519)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:279)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:258)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:244)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:202)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:212)
at groovy.util.ConfigSlurper.parse(ConfigSlurper.groovy:146)
at geb.ConfigurationLoader.loadRawConfig(ConfigurationLoader.groovy:295)
... 10 more
Caused by: java.lang.ClassNotFoundException: org.apache.ivy.core.report.ResolveReport
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 32 more
So I created the folder structure src/test/groovy and src/main/groovy. I also created inside of test/groovy, another folder called store. So I can get this to work if I put the GebConfig.groovy in the src/test/groovy and src/test/groovy/store. Anything else I get the error above. Here is my build.gradle
apply plugin: 'groovy'
repositories {
mavenCentral()
}
dependencies {
groovy group: 'org.codehaus.groovy', name: 'groovy', version: '2.0.5'
groovy group: 'org.apache.ivy', name:'ivy', version:'2.2.0'
compile 'org.codehaus.groovy:groovy-all:2.0.5'
testCompile 'junit:junit:4.11'
testCompile 'org.spockframework:spock-core:0.7-groovy-2.0'
testCompile 'org.gebish:geb-spock:0.9.0-RC-1'
testCompile 'org.seleniumhq.selenium:selenium-firefox-driver:2.31.0'
}
Here is my test
package groovy.store
import geb.spock.GebReportingSpec
class SimpleSpec extends GebReportingSpec {
def "Doing a simple Guest checkout"() {
given: "A test"
def hello
when: ""
hello = "Hello"
then:
assert hello == "Hello"
}
}
Thoughts?
UPDATE v1:
Ok, it looks like I needed to add a new dependency in my build.gradle. I added the ivy dep and now I am getting this error:
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':compileTestGroovy'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:72)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:49)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:34)
at org.gradle.api.internal.changedetection.CacheLockHandlingTaskExecuter$1.run(CacheLockHandlingTaskExecuter.java:34)
at org.gradle.internal.Factories$1.create(Factories.java:22)
at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:179)
at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:232)
at org.gradle.cache.internal.DefaultPersistentDirectoryStore.longRunningOperation(DefaultPersistentDirectoryStore.java:142)
at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateCacheAccess.longRunningOperation(DefaultTaskArtifactStateCacheAccess.java:83)
at org.gradle.api.internal.changedetection.CacheLockHandlingTaskExecuter.execute(CacheLockHandlingTaskExecuter.java:32)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:55)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:41)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:42)
at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:275)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.executeTask(DefaultTaskPlanExecutor.java:52)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.processTask(DefaultTaskPlanExecutor.java:38)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:30)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:84)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:29)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter$1.run(TaskCacheLockHandlingBuildExecuter.java:31)
at org.gradle.internal.Factories$1.create(Factories.java:22)
at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:124)
at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:112)
at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:134)
at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.java:79)
at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter.execute(TaskCacheLockHandlingBuildExecuter.java:29)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:166)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:38)
at org.gradle.launcher.exec.InProcessGradleLauncherActionExecuter.execute(InProcessGradleLauncherActionExecuter.java:39)
at org.gradle.launcher.exec.InProcessGradleLauncherActionExecuter.execute(InProcessGradleLauncherActionExecuter.java:25)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)
at org.gradle.api.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:201)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:170)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:48)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at org.gradle.launcher.Main.main(Main.java:39)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
at org.gradle.launcher.GradleMain.main(GradleMain.java:26)
Caused by: org.gradle.api.internal.tasks.compile.CompilationFailedException: Compilation failed; see the compiler error output for details.
at org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:121)
at org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:39)
at org.gradle.api.internal.tasks.compile.daemon.CompilerDaemonServer.execute(CompilerDaemonServer.java:52)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.messaging.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:355)
at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:66)
Here is my GebConfig
import org.openqa.selenium.firefox.FirefoxDriver
//reportsDir = "target/geb-reports"
// default is to use firefox
driver = {
def driver = new FirefoxDriver()
driver.manage().window().maximize()
return driver
}
environments {
'firefox' {
driver = {
def driver = new FirefoxDriver()
driver.manage().window().maximize()
return driver
}
}
}
UPDATE V2:
Oh, I see if I go a little higher in the stack I see the following:
startup failed:
Could not instantiate global transform class org.spockframework.compiler.SpockTransform specified at jar:file:/Users/john/.gradle/caches/artifacts-23/filestore/org.spockframework/spock-core/0.7-groovy-2.0/jar/4de0b428de0c14b6eb6375d8174f71848cbfc1d7/spock-core-0.7-groovy-2.0.jar!/META-INF/services/org.codehaus.groovy.transform.ASTTransformation because of exception org.spockframework.util.IncompatibleGroovyVersionException: The Spock compiler plugin cannot execute because Spock 0.7.0-groovy-2.0 is not compatible with Groovy 1.8.6. For more information, see http://versioninfo.spockframework.org
Spock location: file:/Users/john/.gradle/caches/artifacts-23/filestore/org.spockframework/spock-core/0.7-groovy-2.0/jar/4de0b428de0c14b6eb6375d8174f71848cbfc1d7/spock-core-0.7-groovy-2.0.jar
Groovy location: file:/Users/john/bin/gradle-1.5/lib/groovy-all-1.8.6.jar
UPDATE v3:
So I added regular groovy into my dependencies, see above. I am not passing the compile stage and failing at the test stage. Here is the message that is coming up in the report
geb.ConfigurationLoader$UnableToLoadException: Unable to load configuration from class 'class GebConfig' (with environment: null)
at geb.ConfigurationLoader.loadRawConfig(ConfigurationLoader.groovy:297)
at geb.ConfigurationLoader.loadRawConfig(ConfigurationLoader.groovy:290)
at geb.ConfigurationLoader.getConf(ConfigurationLoader.groovy:226)
at geb.ConfigurationLoader.doGetConfFromClass(ConfigurationLoader.groovy:200)
at geb.ConfigurationLoader.getConf(ConfigurationLoader.groovy:95)
at geb.ConfigurationLoader.getConf(ConfigurationLoader.groovy:114)
at geb.spock.GebSpec.createConf(GebSpec.groovy:29)
at geb.spock.GebSpec.createBrowser(GebSpec.groovy:33)
at geb.spock.GebSpec.getBrowser(GebSpec.groovy:38)
at geb.spock.GebSpec.methodMissing(GebSpec.groovy:51)
at geb.spock.GebReportingSpec.setupSpec(GebReportingSpec.groovy:30)
Caused by: java.lang.ExceptionInInitializerError
at java.lang.Class.forName(Class.java:249)
at groovy.util.ConfigSlurper.parse(ConfigSlurper.groovy:127)
at geb.ConfigurationLoader.loadRawConfig(ConfigurationLoader.groovy:295)
... 10 more
Caused by: java.lang.RuntimeException: No suitable ClassLoader found for grab
at groovy.grape.GrapeIvy.chooseClassLoader(GrapeIvy.groovy:181)
at groovy.grape.GrapeIvy.grab(GrapeIvy.groovy:247)
at groovy.grape.GrapeIvy.grab(GrapeIvy.groovy:236)
at groovy.grape.Grape.grab(Grape.java:129)
... 13 more
@Grab
anywhere, for example in yourGebConfig.groovy
? – Interlineategeb.ConfigurationLoader$UnableToLoadException: Unable to load configuration @ 'file:/Users/john/Development/groovy/gradlegebautomation/build/resources/test/GebConfig.groovy' (with environment: null)
in your GebConfig.groovy suck configuration. Try run geb+spock example. – Remiss