5

We are planning to upgrade Grails for our application from version 2.0.1 to 3.1.1. On executing

    grails clean --stacktrace --verbose    

I am getting the exception given below:

   | Error Error occurred running Grails CLI: null
     java.lang.NullPointerException
    at org.grails.cli.GrailsCli.initializeProfile(GrailsCli.groovy:504)
    at org.grails.cli.GrailsCli.initializeApplication(GrailsCli.groovy:308)
    at org.grails.cli.GrailsCli.execute(GrailsCli.groovy:271)
    at org.grails.cli.GrailsCli.main(GrailsCli.groovy:162)
  | Error Error occurred running Grails CLI: null

I also tried by setting GRAIL_OPTS but it is still not working.

   set GRAILS_OPTS="-XX:-UseSplitVerifier -Xverify:none"

Environment details:

    | Grails Version: 3.1.1
    | Groovy Version: 2.4.5
    | JVM Version: 1.8.0_74

Any pointers will be appreciated.

Thanks.

Yuri
  • 4,254
  • 1
  • 29
  • 46
Atul
  • 1,536
  • 3
  • 21
  • 37
  • 1
    I get that error when using Grails 3.1.1 in a Grails 2 project. If your project has not yet been upgraded, then continue using Grails 2 on the command line. Also, [SDKMAN](http://sdkman.io/ "SDKMAN") is your friend when working on projects with different versions :-) – jnunderwood Feb 29 '16 at 23:32

2 Answers2

0

In a grails 3.2.11 project you would solve this in the following way. Look in /gradle.properties to see what grailsVersion is set to. Mine looks like this: grailsVersion=3.2.11

Open a command window and check your grails version

$ grails -version
| Grails Version: 3.2.11
| Groovy Version: 2.4.11
| JVM Version: 1.8.0_144

They should match. If they do not, use sdkman to set or install the correct version

$ sdk list grails
================================================================================
Available Grails Versions
================================================================================
   * 3.3.3                3.2.12               3.1.14               3.0.17         
   * 3.3.2            > * 3.2.11               3.1.13               3.0.16         
     3.3.1                3.2.10               3.1.12               3.0.15         
   * 3.3.0.RC1            3.2.1                3.1.11               3.0.14         
     3.3.0.M2             3.2.0                3.1.10               3.0.13         
   * 3.3.0.M1             3.1.9                3.1.1                3.0.12         
     3.3.0                3.1.8                3.1.0                3.0.11         
   * 3.2.9                3.1.7                3.0.9                3.0.10         
   * 3.2.8                3.1.6                3.0.8                3.0.1          
     3.2.7                3.1.5                3.0.7                3.0.0          
     3.2.6                3.1.4                3.0.6              * 2.5.6          
     3.2.5                3.1.3                3.0.5              * 2.5.5          
   * 3.2.4                3.1.2                3.0.4              * 2.5.4          
   * 3.2.3                3.1.16               3.0.3                2.5.3          
     3.2.2                3.1.15               3.0.2                2.5.2          
================================================================================
+ - local version
* - installed
> - currently in use
================================================================================

If you don't see your version, install it $ sdk install grails 3.2.11 Then set it to your default $ sdk default grails 3.2.11

NightOwl888
  • 55,572
  • 24
  • 139
  • 212
Jabrwoky
  • 61
  • 6
0

Generally, this exception is encountered when you try to run Grails CLI (grails command) within a directory holding an app based on an older version of Grails.

Also it's always worth checking the $PWD for leftovers of a previous Grails app.

Yuri
  • 4,254
  • 1
  • 29
  • 46