No such property: developmentModeActive for class

2019-08-10 15:47发布

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 ?

1条回答
Root(大扎)
2楼-- · 2019-08-10 16:29

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'
    }
}
查看更多
登录 后发表回答