Hey, this is an older post and most links don’t work anymore but it seems that I have the same problem.
I created a Gradle project, added builcSrc and created an example plugin in there. First I created it with gradle init
but I tried to remove everything that is not required, so only buildSrc/build.gradle
and buildSrc/src/main/java/org/example/MypluginPlugin.java
remain.
I added the plugin to my plugins
block in my main project but now it fails:
Calculating task graph as no cached configuration is available for tasks: clean
FAILURE: Build failed with an exception.
* Where:
Settings file 'C:\src\gradlebuildsrcplugin\settings.gradle' line: 11
* What went wrong:
Plugin [id: 'my-plugin'] was not found in any of the following sources:
- Gradle Core Plugins (not a core plugin. For more available plugins, please refer to https://docs.gradle.org/8.14.2/userguide/plugin_reference.html in the Gradle documentation.)
- Included Builds (No included builds contain this plugin)
- Plugin Repositories (plugin dependency must include a version number for this source)
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
BUILD FAILED in 1s
Configuration cache entry stored.
According to 4. Applying convention plugins from the buildSrc
directory this should work, shouldn’t it?
Here is my project: cwansart/gradle-buildsrc-plugin-test - Codeberg.org
After reading Writing Plugins I created a Groovy-based plugin which work, see: Making sure you're not a bot!
But I am not sure why the other example does not work.