[Solved] Package-info.java not compiled for Kotlin packages

I have a mixed Kotlin & Java SpringBoot project (Java is just for xjc generated classes from WSDL). Now, I need to add some package-level annotations to my Kotlin sources, due to the need for manual mapping of some SOAP payloads. While this works for the Java code (built classes have a package-info interface compiled alongside them), it is completely ignored for Kotlin and I cannot seem to find any info on why this is not working. If I read other topics correctly, package-info should be picked-up automatically.

Here are some hopefully relevant snippets from my build script (Kotlin DSL)

plugins {
    kotlin("jvm") version "1.4.10"
    kotlin("plugin.spring") version "1.3.61"
    id("org.jetbrains.kotlin.plugin.allopen") version "1.4.21"
    id("org.springframework.boot") version "2.4.0"
    id("org.unbroken-dome.xjc") version "1.4.3"
}
tasks {
    compileKotlin {
        kotlinOptions.jvmTarget = "1.8"
        kotlinOptions.freeCompilerArgs = listOf("-Xjsr305=strict")
        dependsOn(":xjcGenerate")
    }
    compileTestKotlin {
        kotlinOptions.jvmTarget = "1.8"
        kotlinOptions.freeCompilerArgs = listOf("-Xjsr305=strict")
    }
    xjcGenerate {
        source = fileTree("src/main/schema")
        extraArgs = listOf("-wsdl")
    }
}

Well, I’ll have to admit I was a bit stupid in going about this, having placed the package-info.java files in the Kotlin sources - somehow that made sense yesterday at 10pm, but in hindsight it makes total sense to put them in the java sources.

Problem solved.

3 Likes