Running gradle quarkusDev fails in a multi-module Gradle project
### Describe the bug

I am learning the tutorial: [GETTING STARTED WITH REACTIVE](https://quarkus.io/guides/getting-started-reactive)

When I run `gradle :quarkus-reactive:quarkusDev` in a multi-module gradle project, I get an exception

> Execution failed for task ':quarkus-reactive:compileJava'.
> \\> Cannot change dependencies of dependency configuration ':quarkus-reactive:annotationProcessor' after it has been included in dependency resolution. Use 'defaultDependencies' instead of 'beforeResolve' to specify default dependencies for a configuration.

When I comment out `implementation("io.quarkus:quarkus-hibernate-reactive-panache")` it works fine

### Expected behavior

This Quarkus plugin should work fine in other submodules

### Actual behavior

this Quarkus plugin doesn't seem to be able to execute `compileJava` task in submodule

### How to Reproduce?

Here is my example code:

[reproduce/quarkus at main · tabuyos/reproduce](https://github.com/tabuyos/reproduce/tree/main/quarkus)

Execute the `gradle :quarkus-reactive:quarkusDev` task in the quarkus directory

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

Microsoft Windows [version 10.0.19043.1466]

### Output of `java -version`

openjdk version "16" 2021-03-16

### GraalVM version (if different from Java)

_No response_

### Quarkus version or git rev

2.7.1.Final

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

Gradle 7.0.2

### Additional information

_No response_
diff --git a/devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/dependency/ApplicationDeploymentClasspathBuilder.java b/devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/dependency/ApplicationDeploymentClasspathBuilder.java
index 049f5f9355d..8b6e31b5fee 100644
--- a/devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/dependency/ApplicationDeploymentClasspathBuilder.java
+++ b/devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/dependency/ApplicationDeploymentClasspathBuilder.java
@@ -70,10 +70,12 @@ public static void initConfigurations(Project project) {
                         configContainer.getByName(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME));
 
         // enable the Panache annotation processor on the classpath, if it's found among the dependencies
-        configContainer.getByName(JavaPlugin.ANNOTATION_PROCESSOR_CONFIGURATION_NAME).getIncoming()
-                .beforeResolve(annotationProcessors -> {
-                    Set<ResolvedArtifact> compileClasspathArtifacts = configContainer
-                            .getByName(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME).getResolvedConfiguration()
+        configContainer.getByName(JavaPlugin.ANNOTATION_PROCESSOR_CONFIGURATION_NAME)
+                .withDependencies(annotationProcessors -> {
+                    Set<ResolvedArtifact> compileClasspathArtifacts = DependencyUtils
+                            .duplicateConfiguration(project, configContainer
+                                    .getByName(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME))
+                            .getResolvedConfiguration()
                             .getResolvedArtifacts();
                     for (ResolvedArtifact artifact : compileClasspathArtifacts) {
                         if ("quarkus-panache-common".equals(artifact.getName())
['devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/dependency/ApplicationDeploymentClasspathBuilder.java']