Skip to content
This repository has been archived by the owner on Aug 19, 2020. It is now read-only.

KotlinBuildScriptDependenciesResolver should return valid javaHome #1354

Closed
NataliaUkhorskaya opened this issue Feb 28, 2019 · 6 comments
Closed

Comments

@NataliaUkhorskaya
Copy link

KotlinBuildScriptDependenciesResolver should contains javaHome in the returned script dependencies. Otherwise gradle.kts scripts can be highlighted with errors if non-java sdk is set as Project SDK in Intellij IDEA

related tiked: https://youtrack.jetbrains.com/issue/KT-21501

Expected Behavior

ScriptDependencies.javaHome is set to some valid value. It can be obtained from environment parameter passed into resolve method.

Current Behavior

javaHome is null

@eskatos
Copy link
Member

eskatos commented Mar 14, 2019

This will ship in Gradle 5.4

@eskatos
Copy link
Member

eskatos commented Apr 16, 2019

@NataliaUkhorskaya, this shipped in Gradle 5.4
We are seeing some issues with IntelliJ Kotlin plugin 1.3.30 not recognizing JDK types in the script editor:

image

Could it be related?

@JLLeitschuh
Copy link
Contributor

@eskatos This looks like a Java 10+ issue. I'm guessing you wouldn't see that problem if the language version was set to Java 8. Just a thought.

@wolfs
Copy link
Member

wolfs commented Apr 16, 2019

Using Java 8 in some places makes the problem go away...

@eskatos
Copy link
Member

eskatos commented Apr 17, 2019

The scripts already use Java 8 language version.

But yes, if the build is imported using Java 11 then this problem shows up, it doesn't happen if the build was imported using Java 8.

@eskatos
Copy link
Member

eskatos commented Apr 24, 2019

In my comment above it worked for me importing with Java 8 because both Gradle
JVM
and Project SDK were the same, not demonstrating the problem.

The root problem is that the Kotlin DSL IDEA script editor can't find JDK classes with Gradle 5.4 if Gradle JVM != Project SDK. See gradle/gradle#9195

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants