You are not able to override existing project properties from command line, take a look here. So try to rename a version variable to something differing from version and set it with -P
flag before command, like:
gradle -PprojVersion=10.2.10 build
And then in your build.gradle
if (project.hasProperty('projVersion')) {
project.version = project.projVersion
} else {
project.version = '10.0.0'
}
Or as you did with ?: operator
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…