Below I've set the version for all projects
allprojects {
version='1.0.0'
}
I'd rather have it in a file gradle.properties
.
But is it going to apply to all projects ?
CodePudding user response:
Declaring properties in gradle.properties
instead of in build scripts is indeed a good practice, see https://docs.gradle.org/current/userguide/organizing_gradle_projects.html#declare_properties_in_gradle_properties_file
Properties defined in the root project will be inherited to sub-projects, thanks to properties scopes as described here https://docs.gradle.org/current/dsl/org.gradle.api.Project.html#N14DEB
The extra properties and convention properties are inherited from the project's parent, recursively up to the root project. The properties of this scope are read-only.
So yes, you can define version (and other common properties) in gradle.properties
, these will be applied to all (sub)projects