运行模式导出时,没有此类属性:developmentModeActive用于类问题 [英] No such property: developmentModeActive for class issue when run schema-export

查看:167
本文介绍了运行模式导出时,没有此类属性:developmentModeActive用于类问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

环境:


  • Grails版本:3.0.3 Groovy版本:2.4.3

  • JVM版本:1.8.0_45



步骤:


  1. 通过create-app创建应用程序

  2. 添加classpathorg.grails.plugins:hibernate:4.3.8.1build.gradle

  3. 运行命令grails schema-export


$ b 结果失败,关键错误日志:

 线程Thread-11中的异常groovy.lang.MissingPropertyException:对于class:grails.ui,没有这样的属性:developmentModeActive。 command.GrailsApplicationContextCommandRunner 

Stacktrace:


'p>可能的解决方案:在developmentModeActive在org.codehaus.groovy.runtime.callsite.PogoGetPropertySite
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:51)
。 getProperty(PogoGetPropertySite.java:49)$ or $ $ b $ org.code haus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:304)
在grails.boot.GrailsApp $ _enableDevelopmentModeWatch_closure1.doCall(GrailsApp.groovy:161)
。在grails.boot.GrailsApp $在sun.reflect.NativeMethodAccessorImpl.invoke _enableDevelopmentModeWatch_closure1.doCall(GrailsApp.groovy)在sun.reflect.NativeMethodAccessorImpl.invoke0
(本机方法)
(NativeMethodAccessorImpl.java:62)
在阳光下。 reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
在java.lang.reflect.Method.invoke(Method.java:497)
在org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke( ReflectiveInterceptor.java:1270)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)$ b $ org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass .java:292)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
at groovy.lang.Closure.call(Closure.java:423)
at groovy。 lang.Closure.call(Closure.java:417)
at groovy.lang.Closure.run(Closure.java:504)
at java.lang.Thread.run(Thread.java:745)命令执行错误:无法在null对象上调用方法mkdirs():schemaExport失败


这是Grails 3的错误吗?或者我做错了什么?

解决方案

这个问题已经在 grails 3.0.4 / p>

但您仍然需要应用hibernate依赖修复。我会在这里描述它以使答案对其他人更有帮助(基于此错误报告):

为您的 buildscript.dependencies 部分> build.gradle 看起来像这样:

  buildscript {
//。 ..
依赖关系{
classpathorg.grails:grails-gradle-plugin:$ grailsVersion
classpath'com.bertramlabs.plugins:asset-pipeline-gradle:2.1.1'

//添加这行
classpath'org.grails.plugins:hibernate:4.3.10.4'
}
}


Environment:

  • Grails Version: 3.0.3
  • Groovy Version: 2.4.3
  • JVM Version: 1.8.0_45

Steps:

  1. create app by create-app
  2. add classpath "org.grails.plugins:hibernate:4.3.8.1" to build.gradle
  3. run command grails schema-export

The result is failed, the key error log:

Exception in thread "Thread-11" groovy.lang.MissingPropertyException: No such property: developmentModeActive for class: grails.ui.command.GrailsApplicationContextCommandRunner

Stacktrace:

Possible solutions: developmentModeActive at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:51) at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:304) at grails.boot.GrailsApp$_enableDevelopmentModeWatch_closure1.doCall(GrailsApp.groovy:161) at grails.boot.GrailsApp$_enableDevelopmentModeWatch_closure1.doCall(GrailsApp.groovy) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1270) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:292) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016) at groovy.lang.Closure.call(Closure.java:423) at groovy.lang.Closure.call(Closure.java:417) at groovy.lang.Closure.run(Closure.java:504) at java.lang.Thread.run(Thread.java:745) Command execution error: Cannot invoke method mkdirs() on null object :schemaExport FAILED

Is this a bug for grails 3 ? or I make something wrong ?

解决方案

This problem has been fixed in grails 3.0.4.

But you still have to apply the hibernate dependency fix. I'll describe it here to make the answer more helpful to others (based on this bug-report):

Add a hibernate dependency to buildscript.dependencies section of your build.gradle so it looks like this:

buildscript {
    // ...
    dependencies {
        classpath "org.grails:grails-gradle-plugin:$grailsVersion"
        classpath 'com.bertramlabs.plugins:asset-pipeline-gradle:2.1.1'

        // add this line
        classpath 'org.grails.plugins:hibernate:4.3.10.4'
    }
}

这篇关于运行模式导出时,没有此类属性:developmentModeActive用于类问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆