diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/QuarkusPlugin.java b/devtools/gradle/src/main/java/io/quarkus/gradle/QuarkusPlugin.java index 51d56347154a66..f7d42122adac50 100644 --- a/devtools/gradle/src/main/java/io/quarkus/gradle/QuarkusPlugin.java +++ b/devtools/gradle/src/main/java/io/quarkus/gradle/QuarkusPlugin.java @@ -136,7 +136,14 @@ public void execute(Task test) { JavaPlugin.class, javaPlugin -> { project.afterEvaluate(this::afterEvaluate); + ConfigurationContainer configurations = project.getConfigurations(); JavaCompile compileJavaTask = (JavaCompile) tasks.getByName(JavaPlugin.COMPILE_JAVA_TASK_NAME); + + // By default, gradle looks for annotation processors in the annotationProcessor configuration. + // This configure the compile task to look for annotation processors in the compileClasspath. + compileJavaTask.getOptions().setAnnotationProcessorPath( + configurations.getByName(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME)); + compileJavaTask.dependsOn(quarkusGenerateCode); quarkusGenerateCode.setSourceRegistrar(compileJavaTask::source); @@ -169,8 +176,6 @@ public void execute(Task test) { .plus(mainSourceSet.getOutput()) .plus(testSourceSet.getOutput())); - ConfigurationContainer configurations = project.getConfigurations(); - // create a custom configuration for devmode configurations.create(DEV_MODE_CONFIGURATION_NAME).extendsFrom( configurations.getByName(JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME),