Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle-File warnings In IntelliJ IDEA 2019.1

I upgraded my IntelliJ IDEA installation from 2018.3 to 2019.1 and am now seeing errors in my build.gradle that were not there before. I suspect changed preferences but can not find any.

I am seeing two kinds of errors:

  • Almost everything is underlined and the warning message popup says "No candidates found for method call plugins." or "No candidates found for method call buildscript."
  • I use the Spring Boot plugin and import it on the first line. This is now red and the popup says "Cannot resolve symbol 'SpringBootPlugin'".

Screenshot of IntelliJ error messages

This worked fine in 2018.3. The gradle build works, i.e. running ./gradlew …:build from the command line works and so does running gradle tasks from the IDE.

Update I noticed that in "Project structure" the root module (this is a multi-module build) existed twice: once with the name in settings.gradle and once with the name of the directory the code is in. When changing the name in settings.gradle to the name of the directory, the duplicate entry in "Project structure" disappeared and the errors in build.gradle disappeared.

like image 905
David Avatar asked Apr 02 '19 09:04

David


People also ask

How does IntelliJ recognize Gradle project?

Navigate to the build.In the Gradle tool window, right-click a linked project. From the context menu, select Open Gradle config F4 . IntelliJ IDEA navigates to the appropriate Gradle configuration file and the related build. gradle file opens in the editor.


3 Answers

Try re-importing the gradle project:

IntelliJ IDEA ➔ HelpFind Action ➔ search for "import" or "reimport" ➔ Click on: "Reimport All Gradle Projects"

Edit: This has changed to: Gradle (from the right toolbar) ➔ "Reload All Gradle Projects" (small refresh button)

like image 74
Mr-IDE Avatar answered Oct 22 '22 19:10

Mr-IDE


Fixed with File -> Invalidate caches / Restart

Help -> Find action... -> Reload All Gradle Projects didn't work in Idea 2020.2 with me.

like image 20
fireb86 Avatar answered Oct 22 '22 18:10

fireb86


The same occurred to me in Idea 2019.2 created the spring project from idea and by deleting the .iml file and .idea folder it was fixed

like image 7
BLaZeKiLL Avatar answered Oct 22 '22 19:10

BLaZeKiLL