Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why use Gradle detached configurations?

Tags:

gradle

I'm reading about Gradle's detached dependency configurations and the API docs' method description says "Creates a configuration, but does not add it to this container". What I'd like to know is

  1. Why would I want to do this?
  2. At what point would I then re-attach this dependency configuration?

Some initial searching revealed a plugin related reason but this was not conclusive.

like image 873
Friedrich 'Fred' Clausen Avatar asked Apr 15 '15 01:04

Friedrich 'Fred' Clausen


2 Answers

To summarise what was mentioned here and in my own question on the Gradle forums the reason for using detached configurations is : Resolve artifacts in a general way for dependencies not declared in the build file.

For example, as mentioned by Al Jacinto above, for a plugin you would not want to "pollute" the project using the plugin with irrelevant dependencies. This would also prevent the project using the plugin from interfering with those plugin dependencies.

like image 189
Friedrich 'Fred' Clausen Avatar answered Dec 23 '22 16:12

Friedrich 'Fred' Clausen


There's link in that post http://discuss.gradle.org/t/modify-dependencies-of-plugin-checkstyle-configurations/5969 The guy is complaining that the plugin configuration polluting the project configuration and he has to explicitly exclude it.

Second answer to you question, don't need to reattach. I guess it is just detached to the project but still available for the plugin.

like image 39
Al Jacinto Avatar answered Dec 23 '22 18:12

Al Jacinto