Did you look at this link? https://mrhaki.blogspot.com/2012/09/gradle-goodness-using-objects-for.html?m=1
You could look at the task graph to see if you want to do the expensive operation to get the version (ie in a release scenario). If you’re not doing a release you could use a placeholder (ie -SNAPSHOT
in the link)