vivin / gradle-semantic-build-versioning

Gradle plugin to generate version-numbers and tags using semantic versioning
MIT License
85 stars 32 forks source link

Including version number in application at compile-time #106

Closed nicholastmosher closed 4 years ago

nicholastmosher commented 5 years ago

Hi there, this question may not directly relate to this project, but I feel like it's at least tangentially related. I'm building a command-line application and I would like to be able to provide a command such as ./app --version, which should ideally print out the semantic version of the application when it was built. Do you know a way to build a variable such as the rootProject.version into the application itself? (as opposed to only being available in the gradle build scripts)

If you have any ideas, I'd be happy to hear!

vivin commented 4 years ago

Sorry for the super late response. I imagine you could put it in a properties file in the jar that you can then load up.