ludenus
ludenus

Reputation: 1341

IDEA reports errors in build.gradle.kts while command line gradle run succeeds

I am using Kotlin DSL with Gradle build tool. My gradle build works well both locally and on jenkins server when run from command line.

However IDEA complains and marks several items red with the following errors:

I have tried all 3 options in project settings: - Use default gradle wrapper - Use gradle 'wrapper' task configuration - Use local gradle distribuition

Result if pretty same

QUESTION: is something wrong in config, or is there a fix or workaround for that?

IntelliJ IDEA 2018.1.2 (Community Edition)
Build #IC-181.4668.68, built on April 24, 2018
JRE: 1.8.0_152-release-1136-b29 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.15.0-20-generic

.

Kotlin plugin: 1.2.41-release-IJ2018.1-1

.

Gradle 4.7
------------------------------------------------------------

Build time:   2018-04-18 09:09:12 UTC Revision:     b9a962bf70638332300e7f810689cb2febbd4a6c

Groovy:       2.4.12 Ant:          Apache Ant(TM) version 1.9.9 compiled on February 2 2017 JVM:          1.8.0_171 (Oracle Corporation 25.171-b11) OS:           Linux 4.15.0-20-generic amd64

None of the following functions can be called with the arguments supplied

Cannot access class 'java.lang.Object'. Check your module classpath for missing or conflicting dependencies

UPD: @tweitzel you are right, it was incorrect SDK setting, thanks!

Upvotes: 11

Views: 4486

Answers (1)

Dirk Hoffmann
Dirk Hoffmann

Reputation: 1563

in my case I had set a jdk as File->Project Structure... -> Project->Project SDK

instead of setting the Kotlin SDK

after setting Kotlin SDK as Project SDK my build.gradle.kts errors disappeared

Upvotes: 5

Related Questions