tg0h
tg0h

Reputation: 665

Why is my syntax highlighting not working in my build.gradle file in intellij

When I create a build.gradle file and open it with IntelliJ, it does not recognize the build.gradle file and a lightbulb appears suggesting that I correct my gradle syntax. See the picture on top. I can still run the gradle file successfully in intellij.

However, when I create a Gradle Project using the New Project option in IntelliJ, I get proper syntax highlighting.

What should I do to get syntax highlighting for my build.gradle file?

build.gradle syntax highlighting not working in intellij

Upvotes: 3

Views: 3798

Answers (1)

Andrey
Andrey

Reputation: 16381

For an IDE to recognize build.gradle files as a Gradle build script instead of simple plain Groovy file it needs to be opened(imported) as a Gradel build file. You can do it from the file's context menu:

enter image description here

Upvotes: 3

Related Questions