Justin Tullgren
08/28/2025, 10:11 PMwithPluginClasspath method to include the gradle plugin under test while also having a test set up that uses a plugin in the gradle plugin portal?
We have a set of gradle plugins that set conventions on other plugins, for example the kotlin jvm plugin. To test them we build up a test build.gradle.kts file with our plugin under test id AND a real kotlin plugin. However if we use withPluginClasspath then testkit can’t find the kotlin plugin.trevjones
08/28/2025, 10:40 PMJustin Tullgren
08/28/2025, 10:40 PMmbonnin
08/28/2025, 10:44 PMwithPluginClasspath at all cost.
@tony also has a small little plugin to help with this: https://github.com/autonomousapps/dependency-analysis-gradle-plugin/tree/main/testkitJustin Tullgren
08/28/2025, 10:46 PMwithPluginClasspath so I am glad to know I am not the only onetony
08/28/2025, 10:49 PMhfhbd
08/29/2025, 6:25 AMVampire
08/29/2025, 6:55 AMmavenLocal or otherwise make sure to use a repository content filter. mavenLocal is broken by design in Maven already, and makes builds slow, and if used lightly flaky at best broken silently at worst.
But besides that, what does "However if we use withPluginClasspath then testkit can’t find the kotlin plugin." mean in error messages? withPluginClasspath iirc adds your plugin's runtime classpath to a parent class loader, similar to dependencies in buildSrc. If your plugin then wants to use some plugin classes that are added by the target build those are on a descendent class loader and cannot be found, so you would need to add it to the injected classpath if not using local publishing for testing.Justin Tullgren
08/29/2025, 1:29 PMplugins {
id("org.jetbrains.kotlin.jvm") version "x.x.x"
id("plugin.under.test")
}
and we will generate a settings.gradle.kts file like so
pluginManagement {
repositories {
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositories {
mavenCentral()
}
}
and when test kit runs the gradle build we get the error
no plugin found with the id [“org.jetbrains.kotlin.jvm”].
There is also a bunch of meta space(?) errors with the build cache. I don’t believe this to be the issue cause i delete the cache all the time and it still fails.Vampire
08/29/2025, 1:49 PMno plugin found with the id ["org.jetbrains.kotlin.jvm"]. seems strange.
If your plugin would not find the classes if it only has a compileOnly dependency, that would have been my guess without that information.
What is the full error message?
If it says it did not find the plugin with that id, it should also tell where it looked for it.Justin Tullgren
08/29/2025, 1:49 PMJustin Tullgren
08/29/2025, 1:54 PMVampire
08/29/2025, 1:57 PMJustin Tullgren
08/29/2025, 1:58 PMJustin Tullgren
08/29/2025, 1:59 PMVampire
08/29/2025, 2:03 PMVampire
08/29/2025, 2:03 PMJustin Tullgren
08/29/2025, 2:03 PMtony
08/29/2025, 2:10 PMIf publishing to test, better publish to some dedicated separate local repository rather thanmy testkit-support plugin publishes to a separate repo in theor otherwise make sure to use a repository content filter.mavenLocal
build/ dir fyi