具有带连字符的名称的Grails插件的命名约定

时间:2014-04-29 13:41:42

标签: grails groovy configuration

我希望我的Grails应用(myapp)使用我正在开发的名为grails-myapp-auth的插件。

我使用标准Grails目标创建插件:

grails create-plugin myapp-auth

然后开始开发它。

myapp的`BuildConfig.groovy中,我通过以下方式指定插件的本地位置:

grails.plugin.location.myapp-auth = '../../../myapp-auth'

但是这给了我:

| Error WARNING: Inline plugins for [myapp] cannot be read due to error: startup failed:
/home/myuser/sandbox/eclipse/workspace/myapp/myapp/grails-app/conf/BuildConfig.groovy: 4: 
(grails.plugin.location.myapp - auth) is a binary expression, but it should be a variable expression at line: 4 column: 39. File: /home/myuser/sandbox/eclipse/workspace/myapp/myapp/grails-app/conf/BuildConfig.groovy @ line 4, column 39.
    grails.plugin.location.myapp-auth = '../../../myapp-auth'

所以看起来Grails正试图将配置评估为二进制表达式,如下所示:

<Some Value>                  -  <Another Value> =  <Yet Another Value>
grails.plugin.location.myapp  -  auth            =  '../../../myapp-auth'

我该怎么做才能解决这个问题。如果可能的话,我想保留名为myapp-auth的插件,但是如果绝对必要的话,可以在我的鼻子上放一个衣夹并将其缩短到myappauth

1 个答案:

答案 0 :(得分:2)

使用单引号:

grails.plugin.location.'myapp-auth' = '../../../myapp-auth'