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 4cd8d5bb33714..6445b0894d22e 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 19f60a1466526..88ebef62663c2 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 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() {