Reputation: 14867
I'm developing an Android project with Android Studio and gradle. I have seen that from Gradle 2.1+
you can include plugins with the new plugin instruction, like this:
plugins {
id "me.tatarka.retrolambda" version "3.2.5"
}
Where does this instruction go? In which gradle file do I have to put it, and nested somewhere or just appended at the end?
Upvotes: 3
Views: 636
Reputation: 23637
For an Android project, you'll have to put it in each module build.gradle file, if that particular module uses the plugin.
Upvotes: 1
Reputation: 43728
This is what the gradle documentation has about it:
The new plugins {} block does not support arbitrary Groovy code. It is constrained, in order to be idempotent (produce the same result every time) and side effect free (safe for Gradle to execute at any time).
The form is:
plugins { id «plugin id» version «plugin version» }
Where «plugin version» and «plugin id» must be constant, literal, strings. No other statements are allowed; their presence will cause a compilation error.
The plugins {} block must also be a top level statement in the buildscript. It cannot be nested inside another construct (e.g. an if-statement or for-loop).
The plugins {} block can currently only be used in a project's build script. It cannot be used in script plugins, the settings.gradle file or init scripts.
Upvotes: 3