Apply plugins in settings.gradle does not work, plugins can only be applied to Project

(Matthieu Leclercq) #1

I would like to use a plugin in settings.gradle to ensure a naming convention of projects based on a ‘.properties’ file (basically, the name of the project is a composition of a set or properties specified in a ‘.properties’ file)

I wrote a class that implements


which seems legitimate according to the javadoc of the Plugin interface. But when I apply the plugin in the settings.gradle script

apply plugin:'my-plugin'

I get an UnsupportedOperationException thrown by DefaultObjectConfigurationAction.

Indeed the DefaultObjectConfigurationAction class is only able to apply plugins on Project objects (see applyPlugin methods).

A workaround is to write


in settings.gradle but this syntax is far less readable (in particular, I cannot use the “named plugin” mechanism, so the fully qualified name of the plugin class is explicitly used in the scripts)

Is there another solution to apply plugins on arbitrary objects ?

(Luke Daley) #2

This is not current possible. The issue for this is GRADLE-2066.