Grails检测是否安装了插件 [英] Grails Detect if a Plugin is Installed

查看:115
本文介绍了Grails检测是否安装了插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Grails中有一种方法可以检测到插件已安装。例如,我需要知道是否安装了Acegi插件。如果是的话,我可以运行不同的代码。如果插件没有安装(这是一个可行的选择),那么我可以运行不同的代码。



感谢提前。

解决方案

您可以使用插件管理器来执行此操作:

  import org。 codehaus.groovy.grails.plugins.PluginManagerHolder 

if(PluginManagerHolder.pluginManager.hasGrailsPlugin('acegi')){
...
}


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.

解决方案

You can use the plugin manager for this:

import org.codehaus.groovy.grails.plugins.PluginManagerHolder

if (PluginManagerHolder.pluginManager.hasGrailsPlugin('acegi')) {
   ...
}

这篇关于Grails检测是否安装了插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆