jooby icon indicating copy to clipboard operation
jooby copied to clipboard

OpenAPI generation issue in multimodule project

Open IzzzGoy opened this issue 4 weeks ago • 3 comments

Task to generate openAPI falls with Application class not found. Did you forget to set `mainClassName`?

But this code works if you pull it into a single-module project.

jooby = 3.1.2 kotlin = 2.0.0

plugins {
    application
    alias(libs.plugins.jvm)
    alias(libs.plugins.kapt)
    alias(libs.plugins.jooby)
    alias(libs.plugins.dependency.management)
    alias(libs.plugins.jooby.openAPI)

    id("com.google.osdetector") version "1.7.3"
    id("com.github.johnrengelman.shadow") version "8.1.1"
}

group  "com.example.app.server.backend"
version = "1.0-SNAPSHOT"

val mainAppClassName = "com.example.app.server.backend.MainKt"


application {
    mainClass = mainAppClassName
}



dependencies {
    testImplementation(kotlin("test"))
    implementation(project(":api:meta"))

    implementation(platform(libs.jooby.bom))
    implementation(libs.bundles.jooby.bom)
    implementation(libs.swagger.annotations)

    kapt("io.jooby:jooby-apt:3.1.2")

    testImplementation("org.jetbrains.kotlin:kotlin-test")
    testImplementation("io.jooby:jooby-test")
    testImplementation("com.squareup.okhttp3:okhttp:4.12.0")

}

tasks.test {
    useJUnitPlatform()
}

kotlin {

    jvmToolchain(17)

    compilerOptions {
        javaParameters = true
    }
}


tasks {

    kapt {

        arguments {
            arg("jooby.incremental", true)
            arg("jooby.services", true)
            arg("jooby.debug", false)
        }
    }
    test {
        useJUnitPlatform()
    }
    shadowJar {
        mergeServiceFiles()
        dependsOn("openAPI")
    }

    joobyRun {
        mainClass = mainAppClassName
        restartExtensions = listOf("conf", "properties", "class")
        compileExtensions = listOf("java", "kt")
        port = 8080

        dependsOn("openAPI")
    }
}

IzzzGoy avatar Jun 06 '24 13:06 IzzzGoy