Debug gradle/gradle integration test


#1

Hi,

I’m trying to debug an integration test in gradle/gradle with IntelliJ IDEA. If I run the specific spock test from IntelliJ (by clicking the green arrow next to the test function), IntelliJ can’t find the kotlin-std JAR for the gradle-kotlin-dsl module (see stacktrace below). Trying to debug remotely with -Dorg.gradle.debug=true doesn’t work. I setup the project by cloning the repository and running ./gradlew idea followed by ./gradlew build -x check.

Exception in thread "main" java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:65)
Caused by: java.lang.ExceptionInInitializerError
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
	at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:1850)
	at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:3758)
	at org.codehaus.groovy.runtime.callsite.ClassMetaClassGetPropertySite.getProperty(ClassMetaClassGetPropertySite.java:51)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:296)
	at org.gradle.workers.internal.WorkerExecutorParallelIntegrationTest$_closure1.doCall(WorkerExecutorParallelIntegrationTest.groovy:27)
	at org.gradle.workers.internal.WorkerExecutorParallelIntegrationTest$_closure1.doCall(WorkerExecutorParallelIntegrationTest.groovy)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
	at groovy.lang.Closure.call(Closure.java:414)
	at groovy.lang.Closure.call(Closure.java:408)
	at org.spockframework.runtime.extension.builtin.IgnoreIfExtension.evaluateCondition(IgnoreIfExtension.java:61)
	at org.spockframework.runtime.extension.builtin.IgnoreIfExtension.doVisit(IgnoreIfExtension.java:44)
	at org.spockframework.runtime.extension.builtin.IgnoreIfExtension.visitSpecAnnotation(IgnoreIfExtension.java:34)
	at org.spockframework.runtime.extension.builtin.IgnoreIfExtension.visitSpecAnnotation(IgnoreIfExtension.java:31)
	at org.spockframework.runtime.ExtensionRunner.doRunAnnotationDrivenExtensions(ExtensionRunner.java:91)
	at org.spockframework.runtime.ExtensionRunner.runAnnotationDrivenExtensions(ExtensionRunner.java:62)
	at org.spockframework.runtime.ExtensionRunner.runAnnotationDrivenExtensions(ExtensionRunner.java:51)
	at org.spockframework.runtime.ExtensionRunner.run(ExtensionRunner.java:41)
	at org.spockframework.runtime.Sputnik.runExtensionsIfNecessary(Sputnik.java:88)
	at org.spockframework.runtime.Sputnik.getDescription(Sputnik.java:55)
	at com.intellij.junit4.JUnit4IdeaTestRunner.getDescription(JUnit4IdeaTestRunner.java:78)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:50)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
	... 5 more
Caused by: org.gradle.internal.service.ServiceCreationException: Could not create service of type ClassLoaderRegistry using GlobalScopeServices.createClassLoaderRegistry().
	at org.gradle.internal.service.DefaultServiceRegistry$FactoryMethodService.invokeMethod(DefaultServiceRegistry.java:857)
	at org.gradle.internal.service.DefaultServiceRegistry$FactoryService.create(DefaultServiceRegistry.java:808)
	at org.gradle.internal.service.DefaultServiceRegistry$ManagedObjectServiceProvider.getInstance(DefaultServiceRegistry.java:612)
	at org.gradle.internal.service.DefaultServiceRegistry$SingletonService.get(DefaultServiceRegistry.java:669)
	at org.gradle.internal.service.DefaultServiceRegistry.applyConfigureMethod(DefaultServiceRegistry.java:194)
	at org.gradle.internal.service.DefaultServiceRegistry.findProviderMethods(DefaultServiceRegistry.java:176)
	at org.gradle.internal.service.DefaultServiceRegistry.addProvider(DefaultServiceRegistry.java:250)
	at org.gradle.internal.service.ServiceRegistryBuilder.build(ServiceRegistryBuilder.java:52)
	at org.gradle.integtests.fixtures.executer.AbstractGradleExecuter.<clinit>(AbstractGradleExecuter.java:91)
	... 42 more
Caused by: java.lang.IllegalArgumentException: Cannot find JAR 'kotlin-stdlib-1.2.0.jar' required by module 'gradle-kotlin-dsl' using classpath.
	at org.gradle.api.internal.classpath.DefaultModuleRegistry.findDependencyJar(DefaultModuleRegistry.java:254)
	at org.gradle.api.internal.classpath.DefaultModuleRegistry.findDependencyJars(DefaultModuleRegistry.java:152)
	at org.gradle.api.internal.classpath.DefaultModuleRegistry.module(DefaultModuleRegistry.java:142)
	at org.gradle.api.internal.classpath.DefaultModuleRegistry.loadOptionalModule(DefaultModuleRegistry.java:122)
	at org.gradle.api.internal.classpath.DefaultModuleRegistry.loadModule(DefaultModuleRegistry.java:106)
	at org.gradle.api.internal.classpath.DefaultModuleRegistry.getModule(DefaultModuleRegistry.java:86)
	at org.gradle.api.internal.classpath.DefaultModuleRegistry$DefaultModule.findModule(DefaultModuleRegistry.java:338)
	at org.gradle.api.internal.classpath.DefaultModuleRegistry$DefaultModule.collectRequiredModules(DefaultModuleRegistry.java:325)
	at org.gradle.api.internal.classpath.DefaultModuleRegistry$DefaultModule.getAllRequiredModules(DefaultModuleRegistry.java:313)
	at org.gradle.api.internal.DynamicModulesClassPathProvider.allRequiredModulesOf(DynamicModulesClassPathProvider.java:61)
	at org.gradle.api.internal.DynamicModulesClassPathProvider.findClassPath(DynamicModulesClassPathProvider.java:38)
	at org.gradle.api.internal.DefaultClassPathRegistry.getClassPath(DefaultClassPathRegistry.java:34)
	at org.gradle.initialization.DefaultClassLoaderRegistry.<init>(DefaultClassLoaderRegistry.java:31)
	at org.gradle.internal.service.scopes.GlobalScopeServices.createClassLoaderRegistry(GlobalScopeServices.java:207)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
	at org.gradle.internal.service.ReflectionBasedServiceMethod.invoke(ReflectionBasedServiceMethod.java:35)
	at org.gradle.internal.service.DefaultServiceRegistry$FactoryMethodService.invokeMethod(DefaultServiceRegistry.java:855)
	... 50 more

Process finished with exit code 1
Empty test suite.