Search code examples
grailsgrails-plugin

Grails Detect if a Plugin is Installed


Is there a way in Grails to Detect that a plugin is installed. For example I need to know if the "Acegi" plugin is installed. If it is then I can run different Code. If the plugin is not installed (which is a viable option) then I can run different code.

Thanks in Advance.


Solution

  • You can use the plugin manager for this:

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