After upgrading from 2.9 to 2.10, we are getting this error when calling GradleRunner.create()....build():
org.gradle.tooling.internal.consumer.DefaultBuildLauncher.withInjectedClassPath(Lorg/gradle/testkit/jarjar/org/gradle/internal/classpath/ClassPath;)Lorg/gradle/tooling/internal/consumer/AbstractLongRunningOperation;
java.lang.NoSuchMethodError: org.gradle.tooling.internal.consumer.DefaultBuildLauncher.withInjectedClassPath(Lorg/gradle/testkit/jarjar/org/gradle/internal/classpath/ClassPath;)Lorg/gradle/tooling/internal/consumer/AbstractLongRunningOperation;
at org.gradle.testkit.runner.internal.ToolingApiGradleExecutor.run(ToolingApiGradleExecutor.java:98)
at org.gradle.testkit.runner.internal.DefaultGradleRunner.run(DefaultGradleRunner.java:261)
at org.gradle.testkit.runner.internal.DefaultGradleRunner.build(DefaultGradleRunner.java:210)
It seems to be related to this change that moved withInjectedClassPath method between classes - this caused binary incompatibility in Java ByteCode.
This is a known issue and is fixed in the next release. To fix with 2.10, you need to ensure that the test-kit jar is earlier on the classpath than the gradle-core jar. How do you have your dependencies specified? e.g. what does your dependencies {} block look like?
Don’t upgrade 2.10 it has lots of bugs. 2.9 is better in many ways. I have similar issue and post my queries at various iphone Developer forum but no solve my query. and get back to my old 2.9 version
I understand the frustration but no work has been done on this issue in the meantime. You can fix it in the IDE by changing the order of the classpath. Simply move the TestKit JAR before the Tooling API JAR.
I will post an explicit message here when we get around to fixing it.
Our company recently switched to gradle build system from primary scons build system. Whole bunch of our integration tests broken when we switched to gradle 2.10. I had to answer a whole bunch of WHY??? from devs and from management and ignore all of our integration tests. We are intended to have our first release with gradle build system in next 2-3 months.
We wrote this plugin after encountering this issue in our own Gradle plugin development in IDEA – it automatically does the classpath re-ordering (moves TestKit before the Tooling API JAR) whenever the idea task is run. Applying this plugin to a project, re-running the idea task and re-importing the resulting project in IDEA should fix the issue.
@bmuschko, is there a JIRA bug that tracks the underlying issue? Would be interested in following it since the best-case scenario would be for the root issue to be fixed (and depending on the scope/current prioritization and what the fix would involve, might be interested in working on it as well).