Angle Tom
Angle Tom

Reputation: 1130

Gradle idea plugin: java.io.File cannot be cast to org.gradle.api.artifacts.Configuration

I am using

Gradle version: 2.6
Groovy version: 2.3.10

There is an error as the title when I running gradlew idea

Upvotes: 2

Views: 1745

Answers (1)

xlm
xlm

Reputation: 7594

On behalf of Angle Tom:

The cast error occurs when using a build.gradle configured against a older version of Groovy (used by Gradle).

In this case, the issue with Gradle Idea plugin likely arises from the following example from the pre-2.0 Gradle docs which uses Groovy 1.8:

idea {
  module {
    scopes.PROVIDED.plus += configurations.provided
  }
}

From Gradle 2.0, Groovy was updated from 1.8 to 2.3.2 as mentioned in the release notes. The major bump to the Groovy version meant that the syntax for appending to lists changed. Thus the Gradle docs were updated to reflect this:

idea {
  module {
    scopes.PROVIDED.plus += [ configurations.provided ]
  }
}

Upvotes: 3

Related Questions