speshak
speshak

Reputation: 2477

Getting grails application version from within the app

I'd like to display the application version in the footer of my app. Is there a way to get the value of the app.version variable in the application.properties file at runtime?

Upvotes: 16

Views: 11685

Answers (3)

Michal Zmuda
Michal Zmuda

Reputation: 5621

ApplicationHolder is depreciated.

You can use

Holders.grailsApplication.metadata['app.version']

or inject grailsApplication bean by adding field:

def grailsApplication

and access to application version

grailsApplication.metadata['app.version']

Upvotes: 24

ecodan
ecodan

Reputation: 5687

You can also use: ApplicationHolder.application.metadata['app.version']

Upvotes: 5

Burt Beckwith
Burt Beckwith

Reputation: 75671

Use <g:meta>: http://grails.org/doc/latest/ref/Tags/meta.html

Upvotes: 21

Related Questions