I am using gradle to create a small application in IntelliJ I am getting the following error in the code inspection and when I try to run the main function:
Error:(4, 18) Kotlin: Unresolved reference: System
If I build with “gradle build” from the command line the build is successful and the resulting command runs.
here is the code:
fun main(args: Array<String>) {
val cfgDir = System.getProperty("home.dir")
println(cfgDir)
}
And this is the Gradle file:
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.3.0'
}
group 'test'
version '1.0'
repositories {
mavenCentral()
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}