Gradle 7.2 cannot find plugin declared in the rootProject settings.gradle.kts

I am having a problem with my project. The rootProject has no sources and no build.gradle file, because I want the build logic to be in the submodules. I currently have 2 submodules, A and B, where A is a library of methods and classes and B includes A as an implementation dependency.

They use the same plugins for kotlin, dokka, a versioning plugin and the shadowJar plugin so when B tries to load them, they are already on the classpath because of A. I read that the solution is to declare the plugins in one place and reference them from there. So I placed them in the rootProject settings.gradle.kts file inside the pluginManagement{ } block with the version numbers I wanted, as specified in the gradle documentation, and stripped the version reference from the submodules, leaving only the name of the plugin in the plugins{ } block.

IntelliJ seems to compile the project just fine and running ‘gradle tasks’ seens to work as well. But when I try to run the task, an error gets thrown:

Plugin [id: 'org.jetbrains.kotlin.jvm'] was not found in any of the following sources:
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'org.jetbrains.kotlin.jvm'] was not found in any of the following sources:

- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'org.jetbrains.kotlin.jvm'] was not found in any of the following sources:

- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (plugin dependency must include a version number for this source)
  ...

followed by a long stacktrace that means nothing to me.

Any ideas on what I might be doing wrong? Is it possible the settings.gradle.kts file from the rootProject is not included in the build/execution somehow?

Any help would be greatly appreciated, I don’t know much about gradle unfortunately :frowning: