James Allman
James Allman

Reputation: 41208

IntelliJ IDEA gradle project setup

What is the best procedure for beginning a new Gradle project in IntelliJ IDEA 12.1.3?

I created a skeleton build.gradle file with the idea plugin to generate the project files:

apply plugin: 'java'
apply plugin: 'idea'

task wrapper(type: Wrapper) {
    gradleVersion = '1.6'
}

When I open the new project IntelliJ complains that the Groovy SDK is not configured for module:

Groovy SDK is not configured for module 'gradle'

After configuring the Groovy SDK I get Java inspection issues in the build file:

java.sql.Wrapper? (multiple choices...) Alt+Enter

Am I doing something wrong or is this normal for a Gradle based project in IDEA? Should I just disable inspection?


UPDATE

I was able to import a skeleton project and IDEA automatically configured everything properly. However I am still receiving Java inspection errors in build.gradle as shown above.

Build #IU-129.451

Upvotes: 3

Views: 16194

Answers (1)

Peter Niederwieser
Peter Niederwieser

Reputation: 123986

If you use Gradle's idea task to generate project files, this is normal, as there is no way to tell IDEA what the class path of the build script itself is. If you instead use IDEA's Gradle integration ("Import from Gradle model"), this problem doesn't exist.

Upvotes: 3

Related Questions