Grails - Application metadata

Application metadata

Occasionally there exists a need to store information about the application. There is also a need for Grails to know what Grails version an application expects, to failfast when source is incompatible and requires upgrading.

Grails 0.5 onwards has a user-editable "application.properties" in the root dir of all Grails projects. This is used for metadata describing the application, not for configuration.

The values specified in this file are accessible from the GrailsApplication's metadata property, typically using:

println ApplicationHolder.application.metadata['app.version']

There are predefined property names:

  • app.name - the name of the application
  • app.grails.version - the Grails version the application needs
  • app.version - the version of the application
All "app.grails.*" properties are reserved for use by grails.