0

In grails 2 and earlier, plugins installed their source to .grails/<version>/projects/<projectName>/plugins/etc, this made it easy to debug plugins that were installed without having to check out and load the full source... find where problems were that could be hot-deployed. No need to install run the plugin locally.

In grails 3, this seems to be missing... or maybe I'm just missing something? Is there somewhere in my project I can directly modify the plugin source without checking out the plugin, compiling it and then installing it locally?

4

1 回答 1

2

是的,你错过了一些相当重要的东西:)

Grails 2 插件作为包含源代码的 ZIP 文件分发,但 Grails 3+ 插件作为 JAR 文件分发,代码编译成类。与早期的方法相比,这有很多好处,最大的好处是您不能再直接编辑源代码(这是更改插件工作方式的最糟糕的方法)。

你应该做的(在所有版本的 Grails 中)是利用应用程序和已安装插件之间的编译/加载/解析顺序 - 先加载插件,然后加载应用程序。这允许您通过在应用程序代码中创建具有相同名称和相同相对位置的文件(Groovy/Java/GSP/等)来覆盖插件中的几乎所有内容,并且它将自动覆盖插件的文件或类。例如,要覆盖插件的 com.foo.BarController 控制器,请在您的应用程序中创建 grails-app/controllers/com/foo/BarController.groovy(手动或通过复制原始源并修改它)。

于 2017-02-21T01:36:37.850 回答