I had something like this in a file ‘myplugin.gradle’ that I would apply to other projects:
apply plugin: MyPlugin
class MyPlugin implements Plugin<Project> {
void apply(Project project) {
project.configure(project) {
apply plugin: 'java'
apply plugin: 'findbugs'
}
}
// more to it here...
}
Now I need to run with newer Java that FindBugs does not support, so I want to use SpotBugs.
buildscript {
repositories {
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath "gradle.plugin.com.github.spotbugs:spotbugs-gradle-plugin:1.6.9"
}
}
apply plugin: MyPlugin
class MyPlugin implements Plugin<Project> {
void apply(Project project) {
project.configure(project) {
apply plugin: 'java'
apply plugin: 'com.github.spotbugs'
}
}
// more to it here...
}
However it says that “Plugin with id ‘com.github.spotbugs’ not found.” Apparently the class path in the build script block isn’t in effect for a script plugin that is applied to another project with ‘apply from:’ ??
How do I make this work?