Tag: IntelliJ 想法

在更改Kotlin源文件时,使Intellij IDE运行Kotlin / Java注释处理

最近我开始使用Kotlin v1.2和Intellij IDEA v2017.3。 我在Kotlin中实现了一个注释处理器,当一个类使用支持的注释types进行注释时,它将在META-INF下写入一个资源文件。 我可以看到注释处理器正在处理另一个Maven项目,该项目正在使用实现作为依赖项。 如果我运行mvn clean compile ,META-INF下的文件在target / classes / META-INF中正确生成。 我的问题是,当源文件更改时,Intellij不启动注释处理器。 例如,如果我重命名注释的Kotlin类。 资源文件不会重新生成或更新。 (我还没有看到从Intellij工作的注释处理器…) 我还启用了注释处理,并在IDE中配置了“从项目类路径获取处理器”,如下所述。 我将项目导入为Maven项目,这里是我的pom.xml – 正如我所说的:在使用Maven构建时正在工作: 4.0.0 org.example usage 1 1.2.0 ${project.basedir}/src/main/kotlin ${project.basedir}/src/test/kotlin kotlin-maven-plugin org.jetbrains.kotlin ${kotlin.version} 1.8 kapt generate-sources kapt src/main/kotlin org.example.MyProcessor compile compile compile test-compile test-compile test-compile org.jetbrains.kotlin kotlin-stdlib ${kotlin.version} org.example processor 1 junit junit 4.12 test org.jetbrains.kotlin […]