Repository: quarkusio/quarkus
Issue: Adding a quarkusDev dependency on quarkus-flyway does not run migrations on start

### Describe the bug

Add a dependency `quarkusDev 'io.quarkus:quarkus-flyway'` to build.gradle and set `quarkus.flyway.migrate-on-start` to true in application properties.

Start the application with `./gradlew quarkusDev`.


### Expected behavior

Migrations are performed when the application starts in dev mode.


### Actual behavior

The migrations are not performed.

Replacing the `quarkusDev` dependency with an `implementation` dependency works and the migrations are performed.


### How to Reproduce?

_No response_

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

Darwin 20.6.0 Darwin Kernel Version 20.6.0: Tue Oct 12 18:33:42 PDT 2021; root:xnu-7195.141.8~1/RELEASE_X86_64 x86_64

### Output of `java -version`

openjdk version "11.0.8" 2020-07-14 OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.8+10) OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.8+10, mixed mode)

### GraalVM version (if different from Java)

_No response_

### Quarkus version or git rev

2.5.0.Final

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

Gradle 7.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 4cd8d5bb337..6445b0894d2 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
@@ -166,6 +166,10 @@ public void execute(Task test) {
                     project.afterEvaluate(this::afterEvaluate);
                     ConfigurationContainer configurations = project.getConfigurations();
 
+                    // create a custom configuration for devmode
+                    Configuration configuration = configurations.create(DEV_MODE_CONFIGURATION_NAME)
+                            .extendsFrom(configurations.findByName(JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME));
+
                     tasks.named(JavaPlugin.COMPILE_JAVA_TASK_NAME, JavaCompile.class,
                             compileJava -> {
                                 compileJava.mustRunAfter(quarkusGenerateCode);
@@ -188,9 +192,12 @@ public void execute(Task test) {
                     quarkusGenerateCodeDev.configure(task -> task.dependsOn(resourcesTask));
                     quarkusGenerateCodeTests.configure(task -> task.dependsOn(resourcesTask));
 
-                    quarkusDev.configure(task -> task.dependsOn(classesTask, resourcesTask, testClassesTask, testResourcesTask,
-                            quarkusGenerateCodeDev,
-                            quarkusGenerateCodeTests));
+                    quarkusDev.configure(task -> {
+                        task.dependsOn(classesTask, resourcesTask, testClassesTask, testResourcesTask,
+                                quarkusGenerateCodeDev,
+                                quarkusGenerateCodeTests);
+                        task.setQuarkusDevConfiguration(configuration);
+                    });
                     quarkusRemoteDev.configure(task -> task.dependsOn(classesTask, resourcesTask));
                     quarkusTest.configure(task -> task.dependsOn(classesTask, resourcesTask, testClassesTask, testResourcesTask,
                             quarkusGenerateCode,
@@ -218,9 +225,6 @@ public void execute(Task test) {
                                     .plus(mainSourceSet.getOutput())
                                     .plus(testSourceSet.getOutput()));
 
-                    // create a custom configuration for devmode
-                    configurations.create(DEV_MODE_CONFIGURATION_NAME);
-
                     // create a custom configuration to be used for the dependencies of the testNative task
                     configurations.maybeCreate(NATIVE_TEST_IMPLEMENTATION_CONFIGURATION_NAME)
                             .extendsFrom(configurations.findByName(JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_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 19f60a14665..88ebef62663 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
@@ -24,6 +24,7 @@
 import org.gradle.api.plugins.JavaPluginConvention;
 import org.gradle.api.plugins.JavaPluginExtension;
 import org.gradle.api.provider.Provider;
+import org.gradle.api.tasks.CompileClasspath;
 import org.gradle.api.tasks.Input;
 import org.gradle.api.tasks.InputDirectory;
 import org.gradle.api.tasks.Optional;
@@ -50,6 +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;
 
     private File buildDir;
 
@@ -76,6 +78,15 @@ public QuarkusDev(String name) {
         super(name);
     }
 
+    @CompileClasspath
+    public Configuration getQuarkusDevConfiguration() {
+        return this.quarkusDevConfiguration;
+    }
+
+    public void setQuarkusDevConfiguration(Configuration quarkusDevConfiguration) {
+        this.quarkusDevConfiguration = quarkusDevConfiguration;
+    }
+
     @InputDirectory
     @Optional
     public File getBuildDir() {