gradle module build execution fails when using composing build
### Describe the bug

If I build my module with gradle [composite build](https://docs.gradle.org/current/userguide/composite_builds.html) the task fails.
### Expected behavior

build task should complete without errors

### Actual behavior

the task fails with the following message:
```
Execution failed for task ':my-module:quarkusGenerateCode'.
> Failed to process /Users/...../somelib.jar
```
The file is actually there after the build fails, so I guess the task is looking for that file too soon.

### How to Reproduce?

I do apologize, but the two projects are private so I don't have an easy way to create an environment where to reproduce the error

### Output of `uname -a` or `ver`

_No response_

### Output of `java -version`

OpenJDK Runtime Environment GraalVM CE 21.0.0.2

### GraalVM version (if different from Java)

_No response_

### Quarkus version or git rev

2.0.3.Final

### Build tool (ie. output of `mvnw --version` or `gradlew --version`)

Gradle 6.8.3

### Additional information

_No response_
diff --git a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java
index 08cd5ac618d..913565876bf 100644
--- a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java
+++ b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java
@@ -234,16 +234,6 @@ public void execute(Task test) {
                         testSourceSet.getJava().srcDir(
                                 new File(generatedTestSourceSet.getJava().getClassesDirectory().get().getAsFile(), provider));
                     }
-
-                    // enable the Panache annotation processor on the classpath, if it's found among the dependencies
-                    configurations.getByName(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME)
-                            .getResolutionStrategy().eachDependency(d -> {
-                                if ("quarkus-panache-common".equals(d.getTarget().getName())
-                                        && "io.quarkus".equals(d.getTarget().getGroup())) {
-                                    project.getDependencies().add("annotationProcessor", d.getRequested().getGroup() + ":"
-                                            + d.getRequested().getName() + ":" + d.getRequested().getVersion());
-                                }
-                            });
                 });
 
         project.getPlugins().withId("org.jetbrains.kotlin.jvm", plugin -> {
@@ -266,6 +256,13 @@ private void registerConditionalDependencies(Project project) {
                             .declareConditionalDependencies(JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME);
                     deploymentClasspathBuilder.createBuildClasspath(implementationExtensions,
                             JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME);
+                    // enable the Panache annotation processor on the classpath, if it's found among the dependencies
+                    for (ExtensionDependency extension : implementationExtensions) {
+                        if ("quarkus-panache-common".equals(extension.getName()) && "io.quarkus".equals(extension.getGroup())) {
+                            project.getDependencies().add(JavaPlugin.ANNOTATION_PROCESSOR_CONFIGURATION_NAME,
+                                    extension.asDependencyNotation());
+                        }
+                    }
                 });
         project.getConfigurations().getByName(DEV_MODE_CONFIGURATION_NAME).getIncoming().beforeResolve((devDependencies) -> {
             Set<ExtensionDependency> devModeExtensions = conditionalDependenciesEnabler
diff --git a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/dependency/ExtensionDependency.java b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/dependency/ExtensionDependency.java
index 6b81a298736..f454df6c340 100644
--- a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/dependency/ExtensionDependency.java
+++ b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/dependency/ExtensionDependency.java
@@ -94,6 +94,14 @@ public String toModuleName() {
         return String.join(":", this.extensionId.getGroup(), this.extensionId.getName());
     }
 
+    public String getGroup() {
+        return extensionId.getGroup();
+    }
+
+    public String getName() {
+        return extensionId.getName();
+    }
+
     @Override
     public boolean equals(Object o) {
         if (this == o)
['devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/dependency/ExtensionDependency.java', 'devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java']