This message was deleted.
# community-support
s
This message was deleted.
p
error message:
Copy code
org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'app.softwork.gradle.bug.publishedSettingsPlugin'] was not found in any of the following sources:

- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Included Builds (None of the included builds contain this plugin)
- Plugin Repositories (plugin dependency must include a version number for this source)
v
You probably need to
includeBuild("gradle-logic/plugin-testing")
in your root build settings script.
p
This works, but with this change, each build isn't independent anymore, is it?
So in theory the classpath of the includedBuild("gradle-logic") is shared with the plugin classpath of the settings file? I still try to figure out why my settings plugin from https://github.com/hfhbd/testingGradle does not work in a more complex dependency (the linked project works..). Unfortunately, because the Gradle Enterprise plugin is a settings plugin too, it is not possible to create a build scan with a broken settings script file, is it?
v
Just that you include a build does not add it to any class path. That's why the settings plugin cannot be found. It either has to be in the class path of the id found in the plugin repositories or included builds. But probably not in builds included by included builds. If you would apply a plugin from
gradle-logic
and that would bring the
plugin-testing
plugin onto the class path as dependency, it would probably be found.
p
But if including a build does not add the deps to the settings classpath, how does the first sample work? https://github.com/hfhbd/testingGradle
v
Gradle sees that this build will build the plugin with the requested ID, so builds it and adds it to the class path.
If you do not apply the plugin, you will see, that the included build does not get built
p
Interessting, thanks! So adding it to the classpath is expected and a feature, not a bug. So final question, how does Gradle see it? And why does it don't work with another dependecy (but simillar project as https://github.com/hfhbd/testingGradle)?
v
How does it see what? And where does it not work?
p
I have a similar build like https://github.com/hfhbd/testingGradle but with other
published
dependency, containg a settings plugin too. I added the dependency to the real artifact notation in the build-logic build script, and want to use the settings plugin in the root settings file, like in the sample. But I always get the error, the settings plugin is not found:
Copy code
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (plugin dependency must include a version number for this source)
Interessting the line
Included Builds (None of the included builds contain this plugin)
is missing, so how does Gradle "see" which dependency/included build provides the plugin ids? Does Gradle parse the meta-inf/services of each jar?
Or does Gradle use other things, like reading attributes in module file? Because if I add the version for the plugin, the marker artifact is found and the real artifact, the same defined in
build-logic/build.gradle.kts
is found and the plugin is applied (using service loader). How can I debug this behavior?
v
It neither reads jars, nor module files for plugins by included builds, because they do not exist yet potentially. As I said, the included build is only built if actually needed. From your abstract description I cannot tell, as the abstract description could be imprecise. Show as MCVE what does not work
p
That's my problem, the minimal reproducer does work, the full project doesn't. I can't publish the full project, but I could send it to you via pm.
This is the consumer project: Ideally, I don't need to specify the version of
id("app.softwork.kobol.versions")
in the rootSettings file.
v
You cannot apply a plugin in
plugins { ... }
just by adding it to the class path. You could either apply it in a convention plugin in
build-logic
and apply that convention plugin in your root build, or you could apply it the legacy way using
apply(plugin = "app.softwork.kobol.versions")
outside the
plugins { ... }
block.
p
Thank you! Still curious why this works inside the plugins block here, but its okay :D https://github.com/hfhbd/testingGradle
v
Because there it comes directly from a build that is included in the plugin management block
To be usable from the
plugins { ... }
block the plugin must either come from one of the plugin repositories or built in a build included from the plugin management block
p
Ah, because I (accidentally) added the
include(":published")
so it uses the local script and not the published one, stupid mistake. Thanks, finally understand why the reproducer works.
👌 1