## 3.5 Versioning

#### Versioning Basics

Grails has built in support for application versioning. When you first create an application with the create-app command the version of the application is set to `0.1`. The version is stored in the application meta data file called `application.properties` in the root of the project.

To change the version of your application you can run the set-version command:

    grails set-version 0.2

The version is used in various commands including the war command which will append the application version to the end of the created WAR file.

#### Detecting Versions at Runtime

You can detect the application version using Grails' support for application metadata using the api:org.codehaus.groovy.grails.commons.GrailsApplication class. For example within controllers there is an implicit grailsApplication variable that can be used:

    def version = grailsApplication.metadata['app.version']

If it is the version of Grails you need you can use:

    def grailsVersion = grailsApplication.metadata['app.grails.version']

or the `GrailsUtil` class:

    import grails.util.*
    def grailsVersion = GrailsUtil.grailsVersion