Since Gradle 4.6 java projects can add annotation processing to a seperate configuration called annotationProcessor. The processors defined in this configuraion are run automatically via the compileJava task. Therefore, no additional configuration is needed. For a kotlin project however, automatic configuration is not the case and the annotationProcessor configuration does nothing in a pure kotlin project. Instead of the use of the kapt plugin is required (at least for now).

Below shows the usage of both with the spring-context-indexer processor

plugins {
    kotlin("kapt") version "1.3.20"

dependencies {
    // java annotation processor
    // or kotlin annotation processor