How to add environment to Grails

I am trying to add environment to Grails 2.4.4 application as described: http://docs.grails.org/2.4.4/guide/conf.html#environments

I have added config for this environment for everyone Config.groovy, DataSource.groovy, and BootStrap.groovy

as documented.

However, when I try to run my unit tests in this environment using a command grails -Dgrails.env=shippable test-app --unit --stacktrace

, I get an exception that I cannot find the reason for:

| Compiling 16 source files.
| Error Error executing script TestApp: java.lang.NullPointerException: Cannot invoke method newInstance() on null object (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
java.lang.NullPointerException: Cannot invoke method newInstance() on null object
    at _Events$_run_closure2_closure7.doCall(_Events.groovy:24)
    at _Events$_run_closure2.doCall(_Events.groovy:22)
    at _Events$_run_closure2.doCall(_Events.groovy)
    at _Events$_run_closure4.doCall(_Events.groovy:33)
    at org.apache.tools.ant.BuildListener$targetStarted.call(Unknown Source)
    at org.codehaus.gant.GantBinding$_withTargetEvent_closure1.doCall(GantBinding.groovy:89)
    at org.codehaus.gant.GantBinding.withTargetEvent(GantBinding.groovy:89)
    at org.codehaus.gant.GantBinding.this$4$withTargetEvent(GantBinding.groovy)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy:185)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
    at TestApp$_run_closure1.doCall(TestApp.groovy:32)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy:185)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy)
    at org.codehaus.gant.GantBinding.withTargetEvent(GantBinding.groovy:90)
    at org.codehaus.gant.GantBinding.this$4$withTargetEvent(GantBinding.groovy)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy:185)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy)
    at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
    at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
    at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
    at gant.Gant.withBuildListeners(Gant.groovy:427)
    at gant.Gant.this$2$withBuildListeners(Gant.groovy)
    at gant.Gant$this$2$withBuildListeners$0.callCurrent(Unknown Source)
    at gant.Gant.dispatch(Gant.groovy:415)
    at gant.Gant.this$2$dispatch(Gant.groovy)
    at gant.Gant.invokeMethod(Gant.groovy)
    at gant.Gant.executeTargets(Gant.groovy:591)
    at gant.Gant.executeTargets(Gant.groovy:590)
| Error Error executing script TestApp: java.lang.NullPointerException: Cannot invoke method newInstance() on null object

      

Here are lines 18-28 from _Events.groovy:

        Closure installBowerNotification = {
        event 'StatusError', [
            "Failed to install front-end javascript dependencies. " +
            "If you're not working on the CMS, it safe to ignore " +
            "this message. "
        ]
        event 'StatusError', [
            'Please install Yarn and Bower as described in the README. ' +
            '(i.e., `brew install yarn && yarn global add bower`)'
        ]

      

+3


source to share





All Articles