Convention plugin apply false not working?

Hello All,
I’m working with gradle 7.5.1 and kotlin dsl and have this issue:

I would like to create a convention plugin which doesn’t apply the specified plugin:

src/main/kotlin/my-conventions.gradle.kts:

plugins {
    id ("myPluginWhichMustHaveAConfigurationPropertySetIfApplied") apply false
}

when trying to consume the convention-plugin:

plugins {
    id("my-conventions")
}
 An exception occurred applying plugin request [id:my-conventions '']
...
Could not get unknown property ... -> the must have configuration property

what went wrong?
Tom

P.S. You need a sample project, because this is not reproducible ? Give me a hint and I’ll create something in my github accout,

No need to provide an MCVE here.
What you hit is that it should imho actually fail if you try to do that from a precompiled script plugin: Plugins block apply plugins automatically despite "apply false" for precompiled script plugins · Issue #14437 · gradle/gradle · GitHub
The apply false is simply ignored and actually it does not make any sense.
If you write apply false the intention is to add this plugin to the classpath of the script.
But with precompiled script plugins, you define the dependencies - including plugins you want to use - as dependencies in the build script of the project building the plugin, so the plugin already is in the classpath of that script.

Hi Björn,
Thanks for the detailed answer. In fact, I’ve copied and modified the code from
https://docs.gradle.org/current/samples/sample_sharing_convention_plugins_with_build_logic.html#header
for my purposes. So this question is a duplicate of

Maybe a bit “out of topic” here now, but the name “convention plugin” associates for me something like a pattern, which makes it possible to provide a central bundle of plugins for our developers that guarantees that the plugins they apply (from this bundle) are compatible to the gradle version they use for the current project.
That doesn’t seem to work in this case, since most of the plugins we use in our project are only applied in (some) subprojects.
What do you think the appropriate pattern for this task?
Kind regards Tom

Not sure what you mean.
A convention plugin establishes your own conventions like plugins to apply and settings for those plugins.
So yes, “to provide a central bundle of plugins for our developers that guarantees that the plugins they apply (from this bundle) are compatible to the gradle version they use for the current project” should be covered by that.

But I don’t know what you mean with “That doesn’t seem to work in this case, since most of the plugins we use in our project are only applied in (some) subprojects.”.
The convention plugin still defines the plugin version to use.
Just not inline in the precompiled script plugin, but in the declared dependencies of your precompiled script plugin that you define in the build script of the project building the convention plugins, not in the project applying the convention plugins.
Whether you apply the convention plugin in a root project or subproject does not matter for that.
You apply a convention plugin to the project where those convention should be applied, so you might for example have a (sub)project that builds a java library and you apply a convention plugin to it that in turn applies the java-library plugin and some other plugins you want applied in all Java library plugins and does configuration for it.