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 baef115c905a2..8c26e261a3bed 100644 --- a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java +++ b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java @@ -389,12 +389,14 @@ public void execute() throws MojoFailureException, MojoExecutionException { if (enforceBuildGoal) { final PluginDescriptor pluginDescr = getPluginDescriptor(); final Plugin pluginDef = getConfiguredPluginOrNull(pluginDescr.getGroupId(), pluginDescr.getArtifactId()); - if (pluginDef == null || !isGoalConfigured(pluginDef, "build")) { - getLog().warn("The quarkus-maven-plugin build goal was not configured for this project," + - " skipping quarkus:dev as this is assumed to be a support library. If you want to run quarkus:dev" + - " on this project make sure the quarkus-maven-plugin is configured with the build goal" + - " or disable the enforceBuildGoal flag (via plugin configuration or via" + - " -Dquarkus.enforceBuildGoal=false)."); + if (!isGoalConfigured(pluginDef, "build")) { + var currentGoal = getCurrentGoal(); + getLog().warn( + "The quarkus-maven-plugin build goal was not configured for this project, skipping " + + currentGoal + " as this is assumed to be a support library. If you want to run " + currentGoal + + " on this project make sure the quarkus-maven-plugin is configured with the build goal" + + " or disable the enforceBuildGoal flag (via plugin configuration or via" + + " -Dquarkus.enforceBuildGoal=false)."); return; } } @@ -518,10 +520,11 @@ private void handleAutoCompile() throws MojoExecutionException { if (goals.isEmpty() && !StringUtils.isEmpty(project.getDefaultGoal())) { goals = List.of(StringUtils.split(project.getDefaultGoal())); } + final String currentGoal = getCurrentGoal(); int latestHandledPhaseIndex = -1; for (String goal : goals) { - if (goal.endsWith("quarkus:dev")) { + if (goal.endsWith(currentGoal)) { break; } if (goal.indexOf(':') >= 0 || IGNORED_PHASES.contains(goal)) { @@ -541,7 +544,7 @@ private void handleAutoCompile() throws MojoExecutionException { // configured plugin executions by lifecycle phases final Map>> phaseExecutions = new HashMap<>(); // goals with prefixes on the command line - final Map prefixedGoals = new HashMap<>(); + final Map pluginPrefixes = new HashMap<>(); for (Plugin p : project.getBuildPlugins()) { if (p.getExecutions().isEmpty()) { continue; @@ -576,9 +579,7 @@ private void handleAutoCompile() throws MojoExecutionException { } if (!e.getGoals().isEmpty()) { var goalPrefix = getMojoDescriptor(p, e.getGoals().get(0)).getPluginDescriptor().getGoalPrefix(); - for (String goal : e.getGoals()) { - prefixedGoals.put(goalPrefix + ":" + goal, p); - } + pluginPrefixes.put(goalPrefix, p); } } } @@ -586,12 +587,12 @@ private void handleAutoCompile() throws MojoExecutionException { // Map> final Map> executedPluginGoals = new HashMap<>(); for (String goal : goals) { - if (goal.endsWith("quarkus:dev")) { + if (goal.endsWith(currentGoal)) { break; } var colon = goal.indexOf(':'); if (colon >= 0) { - var plugin = prefixedGoals.get(goal); + var plugin = pluginPrefixes.get(goal.substring(0, colon)); if (plugin == null) { getLog().warn("Failed to locate plugin for " + goal); } else { @@ -630,6 +631,11 @@ private void handleAutoCompile() throws MojoExecutionException { } } + private String getCurrentGoal() { + return mojoExecution.getMojoDescriptor().getPluginDescriptor().getGoalPrefix() + ":" + + mojoExecution.getGoal(); + } + private PluginDescriptor getPluginDescriptor() { return mojoExecution.getMojoDescriptor().getPluginDescriptor(); }