I have a webservice coded in kotlin and managed by gradle for the build/dependencies etc...
I want to do a simple thing: When someone call the version REST endpoint of my webservice, it returns the version.
Since gradle already handle the version with the version properties in build.gradle, I thought it would be easy to get this value but it seems it is not... I've been searching google for hours and everything seems so complicated.
Any idea how to handle the version the good way?
Here is what I have right now:
build.gradle
version = "1.0.0"
...
StatusService.kt
class StatusService : IStatusService {
//TODO: Here I would like to get the version from the gradle
//file instead of maintaining 2 places for the version
//Something like Gradle.getProperties("version") for example
override fun getVersion() : String = "1.0.0"
}
I may be completely wrong about this so if you have another equivalent solution, I will accept it too! Thanks
gradle runor execute the resulting jar?filter(ReplaceTokens...)?