diff --git a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/BaseConfig.java b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/BaseConfig.java index 5ea1afc05997c..e9afdb7ca7d0b 100644 --- a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/BaseConfig.java +++ b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/BaseConfig.java @@ -2,6 +2,7 @@ import java.util.List; import java.util.Map; +import java.util.TreeMap; import java.util.function.Predicate; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -60,6 +61,8 @@ Map cachingRelevantProperties(List propertyPatterns) { Predicate> keyPredicate = e -> patterns.stream().anyMatch(p -> p.matcher(e.getKey()).matches()); return values.entrySet().stream() .filter(keyPredicate) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); + .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (s, s2) -> { + throw new IllegalArgumentException("Duplicate key"); + }, TreeMap::new)); } } diff --git a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusGenerateCode.java b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusGenerateCode.java index 1b1cc049c8bd5..f3b5a930bb51a 100644 --- a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusGenerateCode.java +++ b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusGenerateCode.java @@ -3,9 +3,11 @@ import java.io.File; import java.nio.file.Files; import java.nio.file.Path; +import java.util.Collections; import java.util.HashSet; import java.util.Map; import java.util.Set; +import java.util.TreeMap; import java.util.stream.Collectors; import javax.inject.Inject; @@ -76,7 +78,8 @@ Map getInternalTaskConfig() { // an input to the cache key. We need to declare these properties as inputs, because those influence the // execution. // Documented here: https://docs.gradle.org/current/userguide/build_cache.html#sec:task_output_caching_inputs - return Map.of("launchMode", launchMode.name(), "inputSourceSetName", inputSourceSetName); + return Collections.unmodifiableMap( + new TreeMap<>(Map.of("launchMode", launchMode.name(), "inputSourceSetName", inputSourceSetName))); } @InputFiles