0

I have just moved to the new Grails 3.1, and my first app in Grails worked fine. But when I created a another new Grails 3.1 app I ran into a new problem; the problem occurs when try to run using run-app interactively in the new application root:

| Running application...
Error: Could not find or load main class try3grails.Application

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':bootRun'.
> Process 'command '/usr/lib/jvm/java-8-oracle/bin/java'' finished with  non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
| Error Failed to start server (Use --stacktrace to see the full trace)

The class try3grails.Application referers to the first app's main method class I created; so the error seems to be that Grails cannot 'forget' the old app classpath. Does any one have a solution to this or is there something I missed?

Running grails --version gives:

| Grails Version: 3.1.4
| Groovy Version: 2.4.6
| JVM Version: 1.8.0_77

Grails is installed using SDKMan on a ubuntu linux machine.

Ezbob
  • 329
  • 1
  • 9

2 Answers2

2

Make sure you are running run-app from the right directory. Also try to do some cleaning: grails clean could help. If nothing helps - you can clear grails/gradle cache, or create a new app.

Taras Kohut
  • 2,505
  • 3
  • 18
  • 42
  • Thanks, but I tried `grails clean` and `run-app` outside the grails-app folder (where the gralde wrapper is located) but no dice. I have found a solution but that required updating the gradle wrapper from 2.9 to 2.12. – Ezbob Apr 01 '16 at 09:39
  • My problem started when I moved the Application.groovy to a new package. grails clean didn't help. I ended up removing the whole ~/.groovy directory and that fixed the issue (a cache issue I guess). – Robert Hanson Dec 04 '16 at 17:49
0

I believe I have found "workaround" by updating the gradle wrapper version from 2.9 to 2.12(or 2.10 works too).

This is done by updating the version number in gradle.properties and in gradle/wrapper/gradle-wrapper.properties, and then executing:

./gradlew wrapper
Ezbob
  • 329
  • 1
  • 9