diff --git a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/extension/QuarkusPluginExtension.java b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/extension/QuarkusPluginExtension.java index 718a53f8798f9..c4c543fee145b 100644 --- a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/extension/QuarkusPluginExtension.java +++ b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/extension/QuarkusPluginExtension.java @@ -270,10 +270,14 @@ public ListProperty getCachingRelevantProperties() { } public void set(String name, @Nullable String value) { - quarkusBuildProperties.put(String.format("quarkus.%s", name), value); + quarkusBuildProperties.put(addQuarkusBuildPropertyPrefix(name), value); } - public void set(String name, Property value) { - quarkusBuildProperties.put(String.format("quarkus.%s", name), value); + public void set(String name, Provider value) { + quarkusBuildProperties.put(addQuarkusBuildPropertyPrefix(name), value); + } + + private String addQuarkusBuildPropertyPrefix(String name) { + return String.format("quarkus.%s", name); } } diff --git a/devtools/gradle/gradle-application-plugin/src/test/java/io/quarkus/gradle/extension/QuarkusExtensionTest.java b/devtools/gradle/gradle-application-plugin/src/test/java/io/quarkus/gradle/extension/QuarkusExtensionTest.java index 922f37a7bd82b..68668a71071d6 100644 --- a/devtools/gradle/gradle-application-plugin/src/test/java/io/quarkus/gradle/extension/QuarkusExtensionTest.java +++ b/devtools/gradle/gradle-application-plugin/src/test/java/io/quarkus/gradle/extension/QuarkusExtensionTest.java @@ -1,6 +1,8 @@ package io.quarkus.gradle.extension; import static io.quarkus.gradle.QuarkusPlugin.EXTENSION_NAME; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.entry; import org.gradle.api.Project; import org.gradle.testfixtures.ProjectBuilder; @@ -15,4 +17,16 @@ public void extensionInstantiates() { QuarkusPluginExtension extension = project.getExtensions().create(EXTENSION_NAME, QuarkusPluginExtension.class, project); } + + @Test + void prefixesBuildProperty() { + Project project = ProjectBuilder.builder().build(); + project.getPluginManager().apply("java"); + QuarkusPluginExtension extension = project.getExtensions() + .create(EXTENSION_NAME, QuarkusPluginExtension.class, project); + + extension.set("test.args", "value"); + + assertThat(extension.getQuarkusBuildProperties().get()).containsExactly(entry("quarkus.test.args", "value")); + } }