can i add custom java source dirs for a `jvm { wit...
# multiplatform
j
can i add custom java source dirs for a
jvm { withJava() }
target?
s
Have you tried adding src dirs through the source sets? I was able to successfully add source directories to the common source set like this, but I had to go through some trial and error, and many of the syntaxes that look like they will work didn’t, especially for kotlin-script-gradle. https://github.com/ScottPierce/kotlin-html/blob/master/kotlin-html-writer/build.gradle.kts#L22-L23
j
That's precisely what I'm doing now except in
jvmTest
. I've verified the
file
created has a correct final path but its sources are not being included in Java compilation.
s
Are you using the exact method / syntax I use in that example? The reason I ask is because again, there are other source adding syntaxes / functions that compile and look like they will work in kotlin-script-gradle, but don’t actually work.
l
s
@jw yeah, that's the syntax I was using in kotlin that didn't work. Stop using the += syntax and use my function call.
It should work for you when you move to my exact function call