Topera
Topera

Reputation: 12389

How to get grails plugin version from app?

How to get grails plugin version from app?

Details: my app is also a grails plugin.

When I set version, using

grails set-version 0.5

I can't get value using grailsApplication.metadata['app.version'] because value is updated in my FooBarGrailsPlugin.groovy class

The application.properties file remains unchanged.

Tks.


When I run set-version, my class change from:

class FooBarGrailsPlugin {
    def version = 0.1
}

to

class FooBarGrailsPlugin {
    def version = 0.5
}

Upvotes: 1

Views: 1905

Answers (1)

Dónal
Dónal

Reputation: 187529

The following code will print out the name and version of all plugins installed in an app

applicationContext.getBean('pluginManager').allPlugins.each {plugin ->
    println "${plugin.name} - ${plugin.version}"
}

Upvotes: 6

Related Questions