Gradle Kotlin workspace, empty jar

I’ve made a minimal reproducer with one commit on top of bndtools/bnd-workspace.

If I run the jar task for the api project, the jar is empty.

If I change the CounterService.kt file to Java, it builds correctly, and I see it adds files to bin/

If I add the following to the build.gradle.kts, and have a java file in my sources, it adds all to the jar, including kotlin build caches.

tasks.compileKotlin {
    destinationDir = tasks.compileJava.get().destinationDirectory.get().asFile
}

Any idea how to get it to build a Jar correctly with kotlin sources?

It seems that workspace isn’t the way to go for Kotlin:

Yes. It seems Kotlin support in Gradle does not play well with others like the Bnd Workspace model support for Gradle. Best to use a traditional gradle build. See https://github.com/osgi/osgi-test/tree/main/examples/osgi-test-example-gradle for a great example (using Java but can be adapted for Kotlin.)