Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

418
Views
¿Intellij se niega a establecer el jvm objetivo de Kotlin en 1.8?
ParallelStreams.kts:41:15: error: calls to static methods in Java interfaces are prohibited in JVM target 1.6. Recompile with '-jvm-target 1.8' IntStream.range(0,10).parallel().forEach{a -> ^

Ok... no estoy tratando de compilar para 1.6.

File > Project Structure > Project tiene SDK de proyecto 1.8 y nivel de idioma 8 .

File > Project Structure > Modules > Kotlin tiene plataforma de destino: JVM 1.8 .

File > Project Structure > Facets > Kotlin tiene una plataforma de destino: JVM 1.8 .

File > Settings > Compiler > Kotlin Compiler tiene destino jvm versión 1.8 .

Mi archivo de compilación gradle...

 plugins { id 'org.jetbrains.kotlin.jvm' version '1.3.0' } group 'foo' version '1.0-SNAPSHOT' repositories { mavenCentral() } dependencies { //kotlin implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8" implementation "org.jetbrains.kotlin:kotlin-script-runtime:1.3.0" //networking implementation 'com.mashape.unirest:unirest-java:1.4.9' } compileKotlin { kotlinOptions.jvmTarget = "1.8" } compileTestKotlin { kotlinOptions.jvmTarget = "1.8" }

Me estoy quedando sin lugares para verificar 1.8 .

Y sí, he intentado invalidar el caché y reiniciar Intellij. No hace nada para resolver este problema.

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Agregue sourceCompatibility y targetCompatibility para Java 1.8:

 plugins { id 'org.jetbrains.kotlin.jvm' version '1.3.0' } group 'foo' version '1.0-SNAPSHOT' repositories { mavenCentral() } // Add compatibility sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 dependencies { //kotlin implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8" implementation "org.jetbrains.kotlin:kotlin-script-runtime:1.3.0" //networking implementation 'com.mashape.unirest:unirest-java:1.4.9' } compileKotlin { kotlinOptions.jvmTarget = "1.8" } compileTestKotlin { kotlinOptions.jvmTarget = "1.8" }
over 4 years ago · Santiago Trujillo Report

0

Con .kts solo usa esto:

 tasks { withType<KotlinCompile> { kotlinOptions.jvmTarget = "1.8" } } // I am using latest dsl and gradle val kotlinVersion = "1.3.30" val gradleVersion = "5.4+"
over 4 years ago · Santiago Trujillo Report

0

Dado que las tareas de compilación se generan para todas las configuraciones relevantes, es probable que solo cambiar compileKotlin y compileTestKotlin no sea suficiente.

Intente usar el filtrado de tareas para configurar todas las instancias de tareas de KotlinCompile :

 tasks.withType(KotlinCompile) { kotlinOptions.jvmTarget = "1.8" }
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!