How to apply a buildSrc plugin in settings.gradle

Viewed 135

I have a plugin file in <root>/buildSrc/src/main/groovy/stuff/Stuff.groovy:

class StuffPlugin implements Plugin<Settings> {
  @Override
  void apply(final Settings target) {
    target.gradle.ext.someVariable = 'foo'
  }
}

I want to do this in settings.gradle:

import stuff.StuffPlugin

apply plugin: StuffPlugin

But I get:

Could not compile settings file '<root>/settings.gradle'.
> startup failed:
  settings file '<root>/settings.gradle': 1: unable to resolve class stuff.StuffPlugin
   @ line 1, column 1.
     import stuff.StuffPlugin
     ^

What am I doing wrong?

0 Answers
Related