-->

Grails application is not found after updating to

2020-08-09 05:43发布

问题:

I have updated my IntelliJ IDEA Ultimate to the 2016.2 version.

I had a Grails 3 project and now when I open the IDE I get the following error when trying to run my project:

Error running Grails: My_Project: Grails application is not found

I can still open the terminal and run the project manually, but it seems that IntelliJ IDEA no longer recognises my Grails application. When going to "Edit configurations...", in "Application" it says "[none]" and I can't select anything.

Grails Version: 3.1.9 Groovy Version: 2.4.7 JVM Version: 1.8.0_66

回答1:

A Simple solution to this is to refresh the gradle projects.

You can do this by popping out the little gradle tab and hitting the "Refresh All Gradle Projects"



回答2:

I run into the same problem always when i restart intellij. Running grails clean command from the terminal fixed it.



回答3:

First, re-import the project into IntelliJ 2016.2. Choose the build.gradle file for the import. Use the gradle wrapper or a local gradle installation, where you have given IntelliJ the path to the locally installed Gradle. Let IntelliJ re-index everything. Wait until you see no further indexing on the bottom of the screen.

Second, run the application once, with no edit configuration. After this completes with error, you should be able to choose Run -> Edit Configuration / Application.

Third, you can go into the project pane to the grails-app/init/app-name/Application.groovy file and right-click on that and choose Run. After that, an edit configuration will be created.

Finally, you can try to invalidate cache and restart. (This has nothing to do with Edit Configuration, but sometimes the gradle and/or .idea caches get out of sync.)



回答4:

I had the same problem after updating to IntelliJ Ultimate 2019.2. It seems that the "little gradle tab" of the accepted answer no longer exists.

The reason in my case was that the Gradle Plugin had been disabled by the update process.

Resolution: Hit Help > Find Action > Type gradle. You should see a line "Gradle" and a ON-OFF switch at the end of that line. Enable it and restart IntelliJ solved my problem.