Compiler error after created new Grails project
I downloaded 7.0.2 today and created a new Grails project using all of the default values. The default configuration produces a compiler error:
grails-app\conf\Config.groovy
Error:(27,130) unexpected token: .
which resolves as:
grails.views.default.codec="none"
It looks like it's trying to treat "default" as the Java keyword. I'm using grails-1.0-RC2 and groovy-1.0. Running the application from the grails run-app command works fine. Has anyone else seen this?
请先登录再写评论。
Mike, it's usual problem with comprehension of Groovy identifiers with "Java-like point of view". We'll consider this issue, but if you'll look at Groovy syntax specification
http://groovy.codehaus.org/jsr/spec/grammar/#keywordPropertyNames
you'll see, that 'default' keyword cannot be an identifier part. So, this question will be discussed with Groovy team.
Mike, I cannot reproduce this bug. I use Groovy 1.5 and Grails 1.0 RC3. I added appropriate record to Config.groovy file and compilation still worked fine.
Could you describe your environment more precisely?
I think that this is being caused by using Groovy 1.0 for compilation with the most recent Grails (1.0 RC3).
I have recreated this within IDEA when groovy home is set to Groovy 1.0 and Grails Home is set to Grails 1.0 RC3. I believe these two settings to be incompatible, could someone confirm?
However, compiling the project that errors in the IDE at the command line with grails (ie grails run-app) is successful - as expected as Grails will use the correct version of Groovy.
Yes, I recall allowing 'default' as a reference name was a change made some time during 1.5 development, so it seems you are right.
Eugene.
Yep, that was it. Upgrading to Groovy 1.5 fixed the problem.