intellij-platform-gradle-plugin
intellij-platform-gradle-plugin copied to clipboard
Take testFramework artifacts directly from Maven repository
Currently gradle-intellij-plugin adds testFramework*.jar artifacts from the IDE distribution to the dependencies. However these JARs are available as separate artifact in IntelliJ artifacts repository for some time already. So we plan to remove them to reduce size of the distribution. In order to provide smooth migration for the plugin developers, it makes sense to automatically include com.jetbrains.intellij.platform:test-framework to testCompile dependencies.
It's now relevant for GoLand as well. A user needs to do the following to get a relevant test framework.
repositories {
maven("https://cache-redirector.jetbrains.com/intellij-dependencies")
}
dependencies {
testImplementation("com.jetbrains.intellij.go:go-test-framework:GOLAND-212-SNAPSHOT") {
exclude("org.jetbrains.kotlin", "kotlin-stdlib-jdk8")
exclude("org.jetbrains.kotlin", "kotlin-reflect")
exclude("com.jetbrains.rd", "rd-core")
exclude("com.jetbrains.rd", "rd-swing")
exclude("com.jetbrains.rd", "rd-framework")
}
}
It'd be nice to do it automatically for them.
com.jetbrains.intellij.go
doesn't seem to be a directory under https://cache-redirector.jetbrains.com/intellij-dependencies
@tamj0rd2 What are you trying to achieve?
Related issue: although lib/testFramework.jar
is correctly excluded from the production runtime classpath after https://github.com/JetBrains/gradle-intellij-plugin/commit/a10955810, it still exists on the compile classpath. This makes it easy to get NoClassDefFoundError
at runtime. You can reproduce this by referencing com.intellij.testFramework.PlatformTestUtil
from some production sources in a plugin.
Let me know if you'd like a separate issue filed for this.
Let me know if you'd like a separate issue filed for this.
@gharrma I think it's better to create a separate issue about that.
With the IntelliJ Platform Gradle Plugin 2.0, the testFramework.jar
bundled with IDEs is no longer attached to the project — it may be even removed from the distribution in the future.
A new approach is introduced, which requires specifying an explicit dependency on the Test Framework in the project dependencies, like:
repositories {
mavenCentral()
intellijPlatform {
defaultRepositories()
}
}
dependencies {
intellijPlatform {
intellijIdeaCommunity("...")
testFramework(TestFrameworkType.JUnit4)
}
// other dependencies, e.g., 3rd-party libraries
}
The testFramework
helper method is a shorthand for adding Test Framework to the project (JUnit4 or JUnit5 platform variants), but also plugin/technology-specific variants, like Java, Maven, ReSharper, etc.
See Dependencies Extension and TestFrameworkType
type for more details.