I'm trying to use imports in my gradle build scrip...
# gradle
s
I'm trying to use imports in my gradle build script with Kotlin DSL. When i use imports like this
Copy code
import java.nio.file.Files
import java.nio.file.StandardCopyOption
import java.util.concurrent.TimeUnit

plugins {
    id("idea")
    kotlin("jvm") version "1.4.10"
IDEA is unable to parse the file and highlights everything in red. Running a gradle task from the terminal works fine though. When I remove the import statements and put the
plugins
block at the top, the script is parsed correctly but the unimported classes cannot be resolved. Am I doing this incorrectly or is this an IDEA bug?
m
I do this all the time, with the latest versions of IntelliJ, Gradle (kotlin script), Kotlin, and JDK 11.
s
I'm using JDK 1.8 and was using IntelliJ 2020.2.2 (just updated). I found workarounds that don't require imports for the time being