Migrating from Gradle intelliJ Plugin v1 to v2

Answered

Hello.

I'm trying to migrate the org.jetbrains.intellij  v1 plugin to org.jetbrains.intellij.platform v2.

My plugin uses JavaCodeInsightTestFixture so that I've added this dependency testFramework(TestFrameworkType.Bundled) and the tests work fine (the complete configuration can be seen at https://github.com/lobodpav/spock-intellij-plugin)

However, The documentation states

The Bundled type should not be used unless it is necessary, like in the case of Rider, as its test-framework is not published as an artifact.

So I replaced the testFramework(TestFrameworkType.Bundled)  with testFramework(TestFrameworkType.Plugin.Java). However, gradle fails to build the project due to

> Module 'org.codehaus.groovy:groovy' has been rejected:

    Cannot select module with conflict on capability 'org.codehaus.groovy:groovy:3.0.19' also provided by [org.apache.groovy:groovy:4.0.23(groovyRuntimeElements)]

My question: Is there a way to exclude the old Groovy 3 dependency? My project requires Groovy 4.

In a typical Gradle JVM project, I would simply add exclude group: "org.codehaus.groovy", module: “groovy”.

This is my dependency graph:

testRuntimeClasspath - Runtime classpath of 'test'.
+--- com.jetbrains.intellij.java:java-test-framework:{strictly [242, 242.20224.300]; prefer 242.20224.300} -> 242.20224.300
|    +--- com.jetbrains.intellij.platform:test-framework:242.20224.300 (*)
|    +--- one.util:streamex:0.8.2
|    +--- org.jetbrains.intellij.deps.fastutil:intellij-deps-fastutil:8.5.13-jb4
|    +--- org.jetbrains.intellij.deps:asm-all:9.6.1
|    \--- org.codehaus.groovy:groovy:3.0.19 FAILED
+--- org.apache.groovy:groovy:4.0.23 FAILED
+--- org.spockframework:spock-core:2.4-M4-groovy-4.0
|    +--- org.apache.groovy:groovy:4.0.20 FAILED
0
2 comments

I have found a workaround

configurations.testRuntimeClasspath {
    exclude(group = "org.codehaus.groovy", module = "groovy")
}

but I would prefer a “native” support in the testFramework helper method.

0

Your solution is currently the best one.

1

Please sign in to leave a comment.