kapt是否支持kapt?(Is kapt supported in maven?)
是否有可能在基于maven的项目中运行kapt(kotlin注释处理)?
如果是,我如何在maven构建系统中集成kapt?
Is it possible to run kapt (kotlin annotation processing) in a maven based project?
If yes how do I integrate kapt in maven build system?
最满意答案
从Kotlin 1.1.2开始,现在支持Gradle和Maven运行KAPT插件。 这在使用Kotlin注释处理工具中有记录 ,它说:
<execution> <id>kapt</id> <goals> <goal>kapt</goal> </goals> <configuration> <sourceDirs> <sourceDir>src/main/kotlin</sourceDir> <sourceDir>src/main/java</sourceDir> </sourceDirs> <annotationProcessorPaths> <!-- Specify your annotation processors here. --> <annotationProcessorPath> <groupId>com.google.dagger</groupId> <artifactId>dagger-compiler</artifactId> <version>2.9</version> </annotationProcessorPath> </annotationProcessorPaths> </configuration> </execution>在编译之前从kotlin-maven-plugin添加kapt目标的执行:
Since Kotlin 1.1.2 there is now support for both Gradle and Maven to run the KAPT plugins. This is documented in Using Kotlin annotation processing tool where it says to:
<execution> <id>kapt</id> <goals> <goal>kapt</goal> </goals> <configuration> <sourceDirs> <sourceDir>src/main/kotlin</sourceDir> <sourceDir>src/main/java</sourceDir> </sourceDirs> <annotationProcessorPaths> <!-- Specify your annotation processors here. --> <annotationProcessorPath> <groupId>com.google.dagger</groupId> <artifactId>dagger-compiler</artifactId> <version>2.9</version> </annotationProcessorPath> </annotationProcessorPaths> </configuration> </execution>Add an execution of the kapt goal from kotlin-maven-plugin before compile:
更多推荐
发布评论