Repository: quarkusio/quarkus
Issue: Gradle Task quarkusTest stopped working with version 2.6.1

### Describe the bug

`./gradlew quarkusTest` stopped working after upgrading Quarkus to version 2.6.1 

`./gradlew quarkusDev` still works as expected (and also runs the tests, if told so)

### Expected behavior

`./gradlew quarkusTest` runs quarkus in test mode

### Actual behavior

Logs an error:

```
> Task :quarkusGenerateCode
preparing quarkus application

> Task :quarkusGenerateCodeTests
preparing quarkus application

> Task :quarkusTest FAILED

FAILURE: Build failed with an exception.

* What went wrong:
A problem was found with the configuration of task ':quarkusTest' (type 'QuarkusTest').
  - In plugin 'io.quarkus' type 'io.quarkus.gradle.tasks.QuarkusTest' property 'quarkusDevConfiguration' doesn't have a configured value.

    Reason: This property isn't marked as optional and no value has been configured.

    Possible solutions:
      1. Assign a value to 'quarkusDevConfiguration'.
      2. Mark property 'quarkusDevConfiguration' as optional.

    Please refer to https://docs.gradle.org/7.3.3/userguide/validation_problems.html#value_not_set for more details about this problem.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 9s
6 actionable tasks: 6 executed
```

### How to Reproduce?

Steps to reproduce the behaviour:

1. Download and unpack empty project with gradle from code.quarkus.io
2. Run `./gradlew quarkusTest` inside the folder

### Output of `uname -a` or `ver`

Darwin FXMBPFVFF771GQ05N 21.2.0 Darwin Kernel Version 21.2.0: Sun Nov 28 20:29:10 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T8101 arm64

### Output of `java -version`

openjdk version "11.0.13" 2021-10-19

### GraalVM version (if different from Java)

OpenJDK Runtime Environment GraalVM CE 21.3.0 (build 11.0.13+7-jvmci-21.3-b05)

### Quarkus version or git rev

2.6.1

### Build tool (ie. output of `mvnw --version` or `gradlew --version`)

Gradle 7.3.3

### Additional information

_No response_

Changed files:
devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java
devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java

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 c2860d18b4e..8d4451fe3dd 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
@@ -167,7 +167,7 @@ public void execute(Task test) {
                     ConfigurationContainer configurations = project.getConfigurations();
 
                     // create a custom configuration for devmode
-                    Configuration configuration = configurations.create(DEV_MODE_CONFIGURATION_NAME)
+                    Configuration devModeConfiguration = configurations.create(DEV_MODE_CONFIGURATION_NAME)
                             .extendsFrom(configurations.findByName(JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME));
 
                     tasks.named(JavaPlugin.COMPILE_JAVA_TASK_NAME, JavaCompile.class,
@@ -197,12 +197,15 @@ public void execute(Task test) {
                         task.dependsOn(classesTask, resourcesTask, testClassesTask, testResourcesTask,
                                 quarkusGenerateCodeDev,
                                 quarkusGenerateCodeTests);
-                        task.setQuarkusDevConfiguration(configuration);
+                        task.setQuarkusDevConfiguration(devModeConfiguration);
                     });
                     quarkusRemoteDev.configure(task -> task.dependsOn(classesTask, resourcesTask));
-                    quarkusTest.configure(task -> task.dependsOn(classesTask, resourcesTask, testClassesTask, testResourcesTask,
-                            quarkusGenerateCode,
-                            quarkusGenerateCodeTests));
+                    quarkusTest.configure(task -> {
+                        task.dependsOn(classesTask, resourcesTask, testClassesTask, testResourcesTask,
+                                quarkusGenerateCode,
+                                quarkusGenerateCodeTests);
+                        task.setQuarkusDevConfiguration(devModeConfiguration);
+                    });
                     quarkusBuild.configure(
                             task -> task.dependsOn(classesTask, resourcesTask, tasks.named(JavaPlugin.JAR_TASK_NAME)));
 
diff --git a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java
index 88ebef62663..38c19e093c2 100644
--- a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java
+++ b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java
@@ -51,7 +51,7 @@ public class QuarkusDev extends QuarkusTask {
 
     public static final String IO_QUARKUS_DEVMODE_ARGS = "io.quarkus.devmode-args";
     private Set<File> filesIncludedInClasspath = new HashSet<>();
-    private Configuration quarkusDevConfiguration;
+    protected Configuration quarkusDevConfiguration;
 
     private File buildDir;