Applying a plugin by alias to settings.gradle

(Björn Kautler) #1

I have a Gradle plugin that implements Plugin<PluginAware> to be able to be applied to build.gradle and settings.gradle. The following works absolutely find in build.gradle

buildscript { dependencies { classpath files(/path\to\my-plugin.jar/) } }
apply plugin: 'properties'

The same does not work in settings.gradle. There I have to write

buildscript { dependencies { classpath files(/path\to\my-plugin.jar/) } }
apply plugin:

Why won’t the alias work in settings.gradle? Is there something the plugin does wrong? Or something the settings.gradle file does wrong? Or is this a bug in Gradle?

(René Groeschke) #2

Hello Björn, aliases should also work in gradle settings. Can you double check that the jar you’re pointing to contains a plugin descriptor?

(Björn Kautler) #3

Does it need something different from applying to a project? It was not a theoretical question, I really apply the plugin to both, the project and the settings. And I use the very same JAR. Which contains a META-INF/gradle-plugins/ file with a implementation-class property.

(René Groeschke) #4

There’s nothing special except that you’re plugin should extend Plugin instead of Plugin. PluginAware should also be fine.

BTW, I created a sample project at

cheers, René

(Björn Kautler) #5

Hm, assuming you meant Plugin<Settings> and Plugin<Project>, I don’t understand why it is not working then. :frowning:

(René Groeschke) #6

can you create a selfcontained example demoing your issue? than I can have a look

(Björn Kautler) #7

May I just give you my work in progress? You can pull it from Then “./gradlew jar” And apply it to any build in project and / or settings with

buildscript { dependencies { classpath files('path/to/worktree/build/libs/gradle-properties-plugin-1.3.1.jar') } }
  apply plugin: 'properties'
//apply plugin:

The not-commented apply will work in project, in settings, only the commented line will work.

(Björn Kautler) #8

I also prepared a self-contained example at Just clone it and call “./gradlew tasks” for example.

(Björn Kautler) #9

I created another more self-contained example. You don’t need my wip or anything else, just the showcase from (git clone and run ‘’’./gradlew --continue’’’. Then you will see that it works by name in build.gradle always and that it also works by name in settings gradle if the plugin lives in buildSrc. But if the plugin is pulled in as dependency, in this case direclty as JAR, but I also tried through an Ivy repository, then it only works by classname, not by alias.

(Björn Kautler) #10

Rene, were you able to reproduce the problem with this showcase? Can you confirm that this is a gradle bug and not a problem of the plugin or the usage of it?

(Björn Kautler) #11

Anything more I can do to help you analyze this?