I have written a code generator using kapt, and am using it in a project compiling kotlin with maven.
I find that the kapt generator is invoked after Kotlin's compile phase, which prevents me from using the generated code within kotlin in the same project.
However, if I reference the generated classes from within Java in the same project, it works fine. This is because the java compilation phase comes after kotlin's generation phase.
I've specified the kapt goal before Kotlin's compilation goal within the maven config, (as mentioned in the docs) but it doesn't seem to make a difference:
<plugin>
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>kapt</id>
<goals>
<goal>kapt</goal>
</goals>
<configuration>
<sourceDirs>
<sourceDir>src/main/java</sourceDir>
</sourceDirs>
<annotationProcessorPaths>
<annotationProcessorPath>
<groupId>lang.taxi</groupId>
<artifactId>taxi-annotation-processor</artifactId>
<version>${taxi.version}</version>
</annotationProcessorPath>
</annotationProcessorPaths>
</configuration>
</execution>
<execution>
<id>compile</id>
<goals> <goal>compile</goal> </goals>
</execution>
<execution>
<id>test-compile</id>
<goals> <goal>test-compile</goal> </goals>
<configuration>
<sourceDirs>
<sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
<sourceDir>${project.basedir}/src/test/java</sourceDir>
</sourceDirs>
</configuration>
</execution>
</executions>
</plugin>
Is it possible to configure Kotlin to allow me to use the generated code from Kotlin in the same project?