简体   繁体   English

在Grails中指定插件的顺序

[英]Specifying order of plugins in Grails

My grails application depends on several grails plugins that append and entries to web.xml 我的grails应用程序依赖于附加的几个grails插件和web.xml的条目

The problem is I need to control the order the plugins are executed. 问题是我需要控制插件的执行顺序。 There is a particular plugin which is used for some security purposes which adds a filter in web.xml. 有一个特定的插件用于某些安全目的,它在web.xml中添加了一个过滤器。 This filter needs to be the first executed filter in web.xml Thus I would like this filter to be executed last so that I can ensure that this plugin will be appending the configurations in the first position. 此过滤器需要是web.xml中第一个执行的过滤器。因此,我希望最后执行此过滤器,以便我可以确保此插件将配置添加到第一个位置。

I know there is a dependsOn property on the plugin class to ensure it gets executed last, but that only works if I know which plugins are going to be used in combination with this plugin. 我知道插件类上有一个dependsOn属性,以确保它最后执行,但只有当我知道哪些插件将与此插件结合使用时才有效。 I would like this plugin to be general enough so that anyone in my company can use this plugin and know for sure that this gets executed last. 我希望这个插件足够通用,以便我公司的任何人都可以使用这个插件,并确保最后执行此操作。

Is there any way I can ensure a particular plugin gets executed last? 有什么方法可以确保特定的插件最后执行? Either in the grails-plugin project (ie a property of the plugin class) or configuration of the grails application project. 在grails-plugin项目(即插件类的属性)或grails应用程序项目的配置中。

Thanks, 谢谢,

可能更容易找到一种方法让你的插件以不同的方式附加它的过滤器以确保它们被附加到你想要的位置。如果我打算尝试帮助解决这个问题,我将不得不看到插件的代码。那样的。

Does the grails application install plugins using the install-plugin command? grails应用程序是否使用install-plugin命令install-plugin If so, try declaring them in BuildConfig.groovy instead. 如果是这样,请尝试在BuildConfig.groovy声明它们。

plugins {
    runtime ':weceem:0.8' 
    runtime ':hibernate:latest.release'
}

It's possible that plugins declared here are loaded in the same order they're listed, though I haven't tested this theory. 这里声明的插件可能按照它们列出的顺序加载,尽管我没有测试过这个理论。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM