Plugins should use detached configurations for managing their user defined dependencies instead of adding configurations to the project's container


(Luke Daley) #1

The current pattern for plugins that have user defined dependencies is to add a configuration to ‘project.configurations’. This can cause problems as the plugin user may unintentionally influence these configurations via ‘project.configurations.all’.

See this post for an example.

It seems like we should establish the idiom that detached configurations are used for such cases.

So instead of:

configurations {
  checkstyle «checkstyle tools»
}

it would be something like:

checkstyle {
  dependencies «dependency notation»
}

Why use Gradle detached configurations?
(bak2k2) #2

DO you have any answer for this? For me when I try to run gradle with and checkstyle task, it throws an error saying It could not locate the commons logging logfactory in ,my root directory!! Tried including that in dependencies but its not getting added to checkstyle classpath, is it different?