Grails Detect if a plugin is installed

Is there a way in Grails to determine that a plugin is installed. For example, I need to know if the Acegi plugin is installed. If so, I can run another code. If the plugin is not installed (which is a viable option), I can run another code.

Thanks at Advance.

+6
grails grails-plugin
source share
3 answers

To do this, you can use the plugin manager:

import org.codehaus.groovy.grails.plugins.PluginManagerHolder if (PluginManagerHolder.pluginManager.hasGrailsPlugin('acegi')) { ... } 
+7
source share

You can use <plugin: isAvailable> and <plugin: isNotAvailable> .

Example using the OP acegi plugin:

 <plugin:isAvailable name="acegi"> You have acegi installed! </plugin:isAvailable> 
+2
source share

Update for Grails 2.4+

Note that certain holder classes, such as the PluginManagerHolder , were deprecated for several versions of Grails and removed in Grails 2.4. They have been replaced by a single class, grails.util.Holders , which provides access to all the various objects throughout the application through a single access point.

 import grails.util.Holders if (Holders.pluginManager.hasGrailsPlugin('acegi')) { ... } 
+2
source share

All Articles