In build.gradle we can define variables like:
build.gradle
def libVersion=\'someVersion\'
We can override properties in command line with
Here's an example:
ext.greeting = project.hasProperty('greeting') ? project.getProperty('greeting') : 'hello' task greet << { println greeting }
If you run gradle greet, it will print hello.
gradle greet
hello
If you run gradle -Pgreeting=welcome greet, it will print welcome.
gradle -Pgreeting=welcome greet
welcome