Within my Jenkinsfile I would like to read some metadata from a Gradle buildscript, e.g. group
, baseName
and version
. With Maven, I can do something like this:
def pom = readMavenPom file: 'pom.xml'
env.POM_VERSION = pom.version
env.POM_ARTIFACT_ID = pom.artifactId
env.POM_GROUP_ID = pom.groupId
Question is: how can I do the same thing with Gradle, given I have a build.gradle
that looks like this:
ext {
group = 'my.group.com'
baseName = 'myapplication'
version = '0.5.2-SNAPSHOT'
}
Maybe there is a "trick" to read Gradle build information in a Jenkinsfile
since both is Groovy, but I am a Groovy newb :)