Search code examples
gradlegradle-kotlin-dsljooq-codegen

java.lang.ClassNotFoundException gradle test task for generated (jooq) classes


Using the jooq-codegen I generated jooq code under "${layout.buildDirectory.get()}/generated-sources/jooq". I had to add:

kotlin {
    sourceSets["main"].kotlin.srcDir("build/generated-sources/jooq")
}

to be able to run compile the code. However now I have problems running integrations tests:

tasks.test {
    jvmArgs(defaultJvmArgs)
    useJUnitPlatform()
    testLogging.showStandardStreams = true
    testLogging.exceptionFormat = TestExceptionFormat.FULL
}

as I get the following error java.lang.ClassNotFoundException: org.jooq.generated.Tables. How can I include the build/generated-sources/jooq at runtime for integrations tests?


Solution

  • Solved:

    sourceSets {
        test {
            java.srcDir("build/generated-sources/jooq")
        }
    }