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

572
Views
¿Cómo creo un Kotlin SourceSet adicional usando Gradle con Kotlin DSL?

Quiero crear un conjunto de fuentes de prueba lib, src/tlib/kotlin que "se encuentra entre " principal y prueba. Tengo esto, pero no estoy seguro de por qué usaría el directorio fuente de java para kotlin, y necesito obtenerlo dependiendo de mis fuentes principales

 sourceSets { create("tlib").java.srcDir("src/tlib/kotlin") }

actualizar

 Calebs-MBP:phg-entity calebcushing$ ./gradlew build e: Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath: class phg.entity.AbstractEntityBase, unresolved supertypes: org.springframework.data.domain.Persistable > Task :compileTlibKotlin FAILED

Cerrar

 sourceSets { val main by getting val tlib by creating { java { srcDir("src/tlib/kotlin") compileClasspath += main.output runtimeClasspath += main.output } } val test by getting { java { compileClasspath += tlib.output runtimeClasspath += tlib.output } } } configurations { val compile by getting val runtime by getting val tlibCompile by getting { extendsFrom(compile) } val tlibRuntime by getting { extendsFrom(runtime) } val testCompile by getting { extendsFrom(tlibCompile) } val testRuntime by getting { extendsFrom(tlibRuntime) } } dependencies { implementation("${project.group}:constant:[0.1,1.0)") api("javax.validation:validation-api") api("javax.persistence:javax.persistence-api") api("org.springframework.data:spring-data-commons") // has the missing dependency
over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Los complementos se encargan adecuadamente de una serie de cosas, por lo que la adición se trata realmente de configurar el classpath de sourceSet y las configuraciones de cableado.

Aquí hay una respuesta breve que muestra la configuración de classpath y una extensión de configuración:

 sourceSets { val tlib by creating { // The kotlin plugin will by default recognise Kotlin sources in src/tlib/kotlin compileClasspath += sourceSets["main"].output runtimeClasspath += sourceSets["main"].output } } configurations { val tlibImplementation by getting { extendsFrom(configurations["implementation"]) } }
over 4 years ago · Santiago Trujillo Report

0

Hay una pregunta similar para Groovy
¿Cómo agrego un nuevo conjunto de fuentes a Gradle?

 sourceSets { val main by getting val test by getting val tlib by creating { java { srcDir("src/tlib/kotlin") compileClasspath += main.output + test.output runtimeClasspath += main.output + test.output } } } configurations { val testCompile by getting val testRuntime by getting val tlibCompile by getting { extendsFrom(testCompile) } val tlibRuntime by getting { extendsFrom(testRuntime) } }
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!