我的 gradle 构建:
buildscript {
ext.kotlin_version = '1.1.4-3'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: "kotlin-kapt"
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
kapt {
processors = "libs.orm.codeGenerators.ModelProcessor" //PROCESSOR
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
compile "com.google.auto.service:auto-service:1.0-rc3"
}
处理器不在单独的模块中。
处理器什么都不做,#process
它只是简单地抛出,看看它是否在工作。
@AutoService(Processor::class)
@SupportedSourceVersion(SourceVersion.RELEASE_8)
class ModelProcessor : AbstractProcessor() {
override fun process(annotations: MutableSet<out TypeElement>?, roundEnv: RoundEnvironment): Boolean {
throw(Throwable("foo"))
return true
}
override fun getSupportedAnnotationTypes() : MutableSet<String> {
return mutableSetOf<String>("*")
}
}
但绝对没有任何反应。没有错误,什么都没有。我怎样才能让它工作?