Grails编译器会一直运行,可能是因为语法错误(Grails compiler keeps running again and again, possibly because of syntax e

编程入门 行业动态 更新时间:2024-10-18 14:14:17
Grails编译器会一直运行,可能是因为语法错误(Grails compiler keeps running again and again, possibly because of syntax error)

我多次得到这个问题:有时当我命令:grails run-app时,编译器只是一次又一次地运行,即使我之后没有改变任何东西。 看起来像:

Running Grails application.. Server running. Browse to http://localhost:8080/LiningTest [groovyc] Compiling 1 source file to E:\workspace\W1\LiningTest\target\classes [groovyc] Compiling 2 source files to E:\workspace\W1\LiningTest\target\classe s [delete] Deleting directory C:\Documents and Settings\Long\.grails\1.3.6\proj ects\LiningTest\tomcat Running Grails application.. Server running. Browse to http://localhost:8080/LiningTest [groovyc] Compiling 1 source file to E:\workspace\W1\LiningTest\target\classes [groovyc] Compiling 2 source files to E:\workspace\W1\LiningTest\target\classe s [delete] Deleting directory C:\Documents and Settings\Long\.grails\1.3.6\proj ects\LiningTest\tomcat Running Grails application.. Server running. Browse to http://localhost:8080/LiningTest [groovyc] Compiling 1 source file to E:\workspace\W1\LiningTest\target\classes ...

编译成功时,“服务器运行”,但然后它自动重新编译一些文件(我不知道哪个文件),并再次运行,然后再次重新编译...

当我遇到语法错误时,我遇到了这个问题

constraint { number(min:0.50) // the right way is "min: 0..50" }

问题是为什么发生这个问题,以及我如何找到问题的原因。 (我想我错过了一些逗号/点,但现在很难找到,因为没有错误信息!)

更新 :现在我看到问题是,我没有按照文件夹结构规则放置非域名类在src / groovy。

I got this problem several times: Sometimes when I command : grails run-app, the compiler just running again and again, even though I change nothing after that. It looks like:

Running Grails application.. Server running. Browse to http://localhost:8080/LiningTest [groovyc] Compiling 1 source file to E:\workspace\W1\LiningTest\target\classes [groovyc] Compiling 2 source files to E:\workspace\W1\LiningTest\target\classe s [delete] Deleting directory C:\Documents and Settings\Long\.grails\1.3.6\proj ects\LiningTest\tomcat Running Grails application.. Server running. Browse to http://localhost:8080/LiningTest [groovyc] Compiling 1 source file to E:\workspace\W1\LiningTest\target\classes [groovyc] Compiling 2 source files to E:\workspace\W1\LiningTest\target\classe s [delete] Deleting directory C:\Documents and Settings\Long\.grails\1.3.6\proj ects\LiningTest\tomcat Running Grails application.. Server running. Browse to http://localhost:8080/LiningTest [groovyc] Compiling 1 source file to E:\workspace\W1\LiningTest\target\classes ...

The compiler succeeded when "Server running", but then it automatically re-compile some files (I don't know which file), and run again, and then recompile again...

I have met this problem once when I have a syntax error

constraint { number(min:0.50) // the right way is "min: 0..50" }

The question is why this problem happened, and how I can find the cause of the problem. (I guess that I miss some comma/dot somewhere, but now it's hard to find, because of there's no error message!)

UPDATE: Now I see the problem is that I don't follow the folder structure rules when placing non-domain class in src/groovy.

最满意答案

首先要做的是运行:

grails compile -verboseCompile

这至少会告诉你有问题的文件是什么。

显然这可能发生在什么时候

包名称与该文件所在的目录(在您的源根目录下)不匹配。 类名与文件名不同。

看看这个: http : //www.pubbs.net/201007/grails/58100-grails-user-groovyc-causing-grails-to-loop-.html

Peter Ledbrook上周在Groovy&Grails Exchange的讲话中提到了它(在29:20): http ://skillsmatter.com/podcast/java-jee/talk-by-peter-ledbrook

The first thing to do is to run:

grails compile -verboseCompile

That will at least tell you what the problematic file is.

Apparently this can happen when

The package name does not match the directory (under your source root) the file is in. The class name is different from the file name.

Have a look at this: http://www.pubbs.net/201007/grails/58100-grails-user-groovyc-causing-grails-to-loop-.html

And Peter Ledbrook mentioned it in his talk at the Groovy & Grails Exchange last week (at 29:20): http://skillsmatter.com/podcast/java-jee/talk-by-peter-ledbrook

更多推荐

本文发布于:2023-08-01 12:58:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1357998.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:是因为   编译器   语法错误   会一直   Grails

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!