I have a Gradle project, And I want to get a specific value from the build.gradle file using groovy (it's a jenkins job ).
build.gradle:
allprojects {
subprojects {
version = "1.0-SNAPSHOT"
if (project.hasProperty("TestVersion"))
version = project."TestVersion"
}
ext {
sourceCompatibility = 1.8
targetCompatibility = 1.8
springBootVersion = '2.1.0.RELEASE'
TestVersion = '4.0.0-SNAPSHOT'
}
repositories {
mavenLocal()
maven {
maven {
url 'http://repo1.maven.org/maven2/'
}
}
}
I want to get the "TestVersion" version (which is 4.0.0-SNAPSHOT) in a "gradle" way if it is possible and not by a groovy script that just parses a json file. Is there a way to do it or should I just start parsing it as a regular json?