If you have your java sources in src/main/java and your kotlin sources in src/main/kotlin, you have to specify the source sets for the java source files with the sourceSets { } configuration.
The Gradle documentation you linked works for the vanilla Kotlin workspace. Like it's fantastic if you're building an application using Gradle's guidelines but my experience is that deviating within Gradle requires more work and investigation than with other build systems like Bazel and mvn.
I have never needed to declare sourceSets for my mixed java and kotlin projects.
using Gradle's guidelines but my experience is that deviating within Gradle requires more work and investigation than with other build systems like Bazel and mvn.
Not sure what you mean here but maven doesn't let you deviate from their conventions at all. In Gradle you can deviate pretty easily if for some reason you need to.
3
u/wildjokers Apr 14 '23
For a mixed kotlin and java project all I needed to do was add the kotlin jvm plugin and application plugin:
Nothing else was needed and it just works.
This information is in the Gradle documentation:
https://docs.gradle.org/current/samples/sample_building_kotlin_applications.html