Reputation: 11022
One of my plugins needs to behave differently for grails 1.x and 2.x. So I would like to switch based on the grails version used to install the plugin, but I didn't find a way to get the grails version...
Any idea?
Upvotes: 1
Views: 163
Reputation: 454
To check your grails version:
grails -version
When installing an older plugin, be sure to configure the version in
application.properties
in your grails project.
Upvotes: 1
Reputation: 75671
You can use grails.util.Metadata.current.getGrailsVersion()
. Note that you cannot use the property-access variant (grails.util.Metadata.current.grailsVersion
) because Metadata
is a Map
and this will look for the property stored under the key "grailsVersion"
and return null since it's stored under "app.grails.version"
.
Upvotes: 2