使用Emacs编辑Grails源文件时,Emacs将在源文件旁边临时创建hidden write-lock files。例如,如果编辑com/example/MyController
,可能会看到:
rob@machine:~/app$ ls -la grails-app/controllers/com/example/
total 28
drwxrwxr-x 3 rob rob 4096 2011-12-03 13:38 ..
-rw-rw-r-- 1 rob rob 3883 2012-01-03 13:57 MyController.groovy
lrwxrwxrwx 1 rob rob 26 2012-01-04 09:32 .#MyController.groovy -> rob@machine.2136:1324674574
在run-app
期间创建此文件时,Grails会注意到它并尝试编译它,通常会在run-app
控制台日志中产生编译错误:
| Error 2012-01-04 09:32:51,207 [Thread-38] ERROR plugins.AbstractGrailsPluginManager - Plugin [controllers:2.0.0] could not reload changes to file [/home/rob/app/grails-app/controllers/com/example/.#MyController.groovy]: Dynamic method is<Artefact>Class(artefactClass) requires a single Class parameter
Message: Dynamic method is<Artefact>Class(artefactClass) requires a single Class parameter
Line | Method
->> 629 | doCall in SpringSecurityCoreGrailsPlugin$_closure5
这可能只在使用spring-security-core插件时发生,但我没有在没有安装插件的情况下测试它。
我相信这只发生在Grails 2.0中;我从未在1.3.7或更早版本中观察过它。
在run-app
期间自动重新编译时,有没有办法让Grails忽略这些文件?控制哪些文件执行和不重新加载的一般答案将是理想的。
我也接受“不,这不可能”的权威答案。我知道这可能是不可能通过配置,在这种情况下我可能会打开JIRA增强。
答案 0 :(得分:1)
我没有尝试过这个补丁,但看起来最近Graeme解决了这个问题:
https://github.com/grails/grails-core/commit/c201492dfa47419356fbfea2031d22755ea61fe9
第224行排除以点开头的文件(即emacs写锁)
另见:http://jira.grails.org/browse/GRAILS-8539表示这可能会出现在2.0.1
中