I'm writing a Gradle plugin and I'm failing to get the apply plugin:
command to work in the Gradle script that uses the plugin. I'm using Gradle 1.1.
I've build the plugin with clean build
and I'm attempting to add it to the Gradle build via a flat repo for now. That seems to be working but Gradle isn't picking up that there is a plugin with the ID test-plugin
. The project name in the plugin's settings.gradle
is test-plugin
and the properties file in META-INF/gradle-plugins
is also test-plugin.properties
. I'm not sure where else I can specify the plugin ID.
The build.gradle
file in the project that is using the test-plugin
:
repositories { flatDir name: 'libs', dirs: "../build/libs" } dependencies { compile 'test:test-plugin:0.1' } apply plugin: 'test-plugin'
Error from Gradle:
What went wrong: A problem occurred evaluating root project 'tmp'. Plugin with id 'test-plugin' not found.
You apply plugins by their plugin id, which is a globally unique identifier, or name, for plugins. Core Gradle plugins are special in that they provide short names, such as 'java' for the core JavaPlugin. All other binary plugins must use the fully qualified form of the plugin id (e.g. com. github. foo.
The buildScript block determines which plugins, task classes, and other classes are available for use in the rest of the build script. Without a buildScript block, you can use everything that ships with Gradle out-of-the-box.
The plugin Jar has to be added as a build script dependency:
buildscript { repositories { flatDir name: 'libs', dirs: "../build/libs" } dependencies { classpath 'test:test-plugin:0.1' } } apply plugin: "test-plugin"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With