From 8ac83c78f56099d3a70d6fa218f6801c4e02796a Mon Sep 17 00:00:00 2001 From: Laurent SCHOELENS <61973605+laurentschoelens@users.noreply.github.com> Date: Mon, 11 Sep 2023 13:06:48 +0200 Subject: [PATCH] Fixes GH-35831 --- .../main/java/io/quarkus/maven/DevMojo.java | 29 +++++++++++++++++-- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java index 34d04f14e98d9..e9972372ac4f8 100644 --- a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java +++ b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java @@ -701,7 +701,7 @@ private void executeGoal(PluginExec pluginExec, String goal, Map version(pluginExec.plugin.getVersion()), pluginExec.plugin.getDependencies()), goal(goal), - getPluginConfig(pluginExec.plugin, goal, params), + getPluginConfig(pluginExec.plugin, pluginExec.getExecutionId(), goal, params), executionEnvironment( project, session, @@ -720,11 +720,13 @@ private boolean isGoalConfigured(Plugin plugin, String goal) { return false; } - private Xpp3Dom getPluginConfig(Plugin plugin, String goal, Map params) throws MojoExecutionException { + private Xpp3Dom getPluginConfig(Plugin plugin, String executionId, String goal, Map params) + throws MojoExecutionException { Xpp3Dom mergedConfig = null; if (!plugin.getExecutions().isEmpty()) { for (PluginExecution exec : plugin.getExecutions()) { - if (exec.getConfiguration() != null && exec.getGoals().contains(goal)) { + if (exec.getConfiguration() != null && exec.getGoals().contains(goal) + && matchesExecution(executionId, exec.getId())) { mergedConfig = mergedConfig == null ? (Xpp3Dom) exec.getConfiguration() : Xpp3Dom.mergeXpp3Dom(mergedConfig, (Xpp3Dom) exec.getConfiguration(), true); } @@ -762,6 +764,27 @@ private Xpp3Dom getPluginConfig(Plugin plugin, String goal, Map return configuration; } + /** + * Check if the currentExecutionId matches the provided executionId. + *

+ * This method will return true if + *

    + *
  • current execution id is undefined
  • + *
  • execution id is undefined
  • + *
  • both equals (ignoring case)
  • + *
+ * + * @param currentExecutionId current execution id (if defined) + * @param executionId execution id to test matching (if defined) + * @return true if executions ids do match. + */ + private static boolean matchesExecution(String currentExecutionId, String executionId) { + if (currentExecutionId == null) { + return true; + } + return executionId == null || currentExecutionId.equalsIgnoreCase(executionId); + } + private MojoDescriptor getMojoDescriptor(Plugin plugin, String goal) throws MojoExecutionException { try { return pluginManager.getMojoDescriptor(plugin, goal, pluginRepos, repoSession);