'Intellij: Cannot select "Groovy" in "Add Framework Support"

I would like to add Groovy support to my project in Intellij Idea 2018.1. But when I open "Add Framework Support..." from the project context menu, I don't see "Groovy" in the list of frameworks:

enter image description here

I have Groovy installed on my machine and configured it as a global library in in IntelliJ:

enter image description here

Not sure whether this should be possible, but I also cannot add Groovy as an SDK:

enter image description here

I added Groovy as a module dependency:

enter image description here

My underlying problem is that IntelliJ does not properly recognize Groovy code, e.g. I get

Cannot resolve symbol `String`

when I use the String class:

enter image description here

Any hints on how I can make Groovy available as a Framework and an SDK?

Solution

Thanks to CrazyCoder pointing me to the broken JDK. Fixing the JDK and adding Groovy as a module dependency fixed the problem. See https://www.jetbrains.com/help/idea/creating-and-managing-modules.html



Solution 1:[1]

Just to make this question answered.

Make sure your JDK configuration is correct. As @crazycoder commented, OP's is red indicating the path might be incorrect.

Groovy can be added as a module or library in Intellij or dependency in its dependency file (pom.xml, build.gradle etc)

1. Module (in Intellij):

File > Project Structure Ctrl+Alt+Shift+S > click Modules > Dependencies.

Intellij Module dependency

2. Library (in Intellij):

Go to File > Project Structure... > Libraries > Click on the plus sign on the leftmost side > Add the Groovy jar or maven source at your choice

Intellij: project structure menu

3. Dependency (build.gradle):

group 'com.test'
version '1.0.0'

apply plugin: 'groovy'

repositories {
    mavenCentral()
}

dependencies {
    implementation "org.codehaus.groovy:groovy:2.4.5"
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1