TL;DR: source roots added using MavenProject.addCompileSourceRoot
don’t seem to be picked up by the kotlin-maven-plugin.
We wrote our own plugin that generates Kotlin sources that are written to target/generated-sources/foobar
. Our plugin uses MavenProject.addCompileSourceRoot
to make the overall build aware that this directory should be included as an additional source root.
However, kotlin-maven-plugin doesn’t seem to pick up additional source roots added in this way.
So we have to manually specify the additional root like so:
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
<version>${kotlin.version}</version>
<executions>
<execution>
...
<configuration>
<sourceDirs>
<sourceDir>src/main/kotlin</sourceDir>
<sourceDir>target/generated-sources/foobar</sourceDir>
</sourceDirs>
Is there anything we can do to make the Kotlin Maven plugin aware of our additional source root so that users of our plugin don’t have to always add in this boilerplate?