One of my build scripts imports that nebula plugin:
plugins { id 'nebula.ospackage' version '3.5.0' }
I've been moving all of my version info into a separate file that all projects have access to and am wondering what is the correct syntax to convert to something like:
plugins { id 'nebula.ospackage' version "$versions.nebula_gradle_ospackage_plugin" }
When I try running the above with "gradle clean build", I get the following error:
build file 'build.gradle': 2: argument list must be exactly 1 literal non empty string
See https://docs.gradle.org/2.7/userguide/plugins.html#sec:plugins_block for information on the plugins {} block
@ line 2, column 33. id 'nebula.ospackage' version "$versions.nebula_gradle_ospackage_plugin"
The linked article shows how I could use the "buildscript" block, which works, but it seems like there must be a way to make this work in a single line?
You can specify the Gradle version in either the File > Project Structure > Project menu in Android Studio, or update your Gradle version using the command line.
In Android Studio, go to File > Project Structure. Then select the "project" tab on the left. Your Gradle version will be displayed here.
There are two general types of plugins in Gradle, binary plugins and script plugins.
Applying a plugin to a project means that it allows the plugin to extend the project's capabilities. The plugins can do the things such as − Extend the basic Gradle model (e.g. add new DSL elements that can be configured).
You cannot use variable here:
Where «plugin version» and «plugin id» must be constant, literal, strings. No other statements are allowed; their presence will cause a compilation error.
As of Gradle 5.6, you can declare your plugin versions in the gradle.properties
file, and reference these properties in plugins
block.
For example, the gradle.properties
file:
springBootVersion=2.2.0.RELEASE
the plugins
block in build.gradle
:
plugins { id "org.springframework.boot" version "${springBootVersion}" }
See: https://github.com/gradle/gradle/issues/1697#issuecomment-506910915.
See also:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With