ali haider
ali haider

Reputation: 20182

specifying project version in gradle.properties for gradle build

I specified the project version in gradle.properties (previously, it was in build.gradle). I check for the version in build.gradle and the current logic fails for me (while it works if I move the same version statement to build.gradle):

gradle.properties

version '0.0.7-SNAPSHOT'

build.gradle

println(project.version)  //I have tried version instead of project.version
ext.isSnapshot = project.version.endsWith("-SNAPSHOT")
println(isSnapshot)  //prints SNAPSHOT if I copy version to build.gradle
if (project.version.endsWith("-SNAPSHOT")) {
    println("*****this is a SNAPSHOT build*****")
} else {
    println("*****this is a RELEASE build*****")
}

Any thoughts on what might be causing this issue? Thanks

Upvotes: 0

Views: 3802

Answers (1)

Henry
Henry

Reputation: 43728

The gradle.properties have a different syntax, it is a standard Java properties file.

So try:

version:0.0.7-SNAPSHOT

Upvotes: 1

Related Questions