Repository: quarkusio/quarkus
Issue: quarkus  projects does not have maven compiler configured

### Describe the bug

`quarkus21 create --registry-client -S 2.1` create projects that when trying to run `quarkus dev` or `mvn quarkus:dev` fails with:

```
[WARNING] 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 a build goal.
```

same fails with `-S 2.0`

### Expected behavior

that projects created have working devmode

### Actual behavior

_No response_

### How to Reproduce?

_No response_

### Output of `uname -a` or `ver`

_No response_

### Output of `java -version`

_No response_

### GraalVM version (if different from Java)

_No response_

### Quarkus version or git rev

_No response_

### Build tool (ie. output of `mvnw --version` or `gradlew --version`)

_No response_

### Additional information

_No response_

Changed files:
independent-projects/tools/devtools-common/src/main/java/io/quarkus/maven/utilities/MojoUtils.java
devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java

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 c1502b5df17..6897aa4e15a 100644
--- a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java
+++ b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java
@@ -88,7 +88,6 @@
 import io.quarkus.deployment.dev.QuarkusDevModeLauncher;
 import io.quarkus.maven.MavenDevModeLauncher.Builder;
 import io.quarkus.maven.components.MavenVersionEnforcer;
-import io.quarkus.maven.utilities.MojoUtils;
 
 /**
  * The dev mojo, that runs a quarkus app in a forked process. A background compilation process is launched and any changes are
@@ -344,9 +343,9 @@ public void execute() throws MojoFailureException, MojoExecutionException {
         handleAutoCompile();
 
         if (enforceBuildGoal) {
-            Plugin pluginDef = MojoUtils.checkProjectForMavenBuildPlugin(project);
-
-            if (pluginDef == null) {
+            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 a build goal.");
@@ -504,10 +503,14 @@ private void initToolchain() throws MojoExecutionException {
     }
 
     private void triggerPrepare() throws MojoExecutionException {
-        final PluginDescriptor pluginDescr = (PluginDescriptor) getPluginContext().get("pluginDescriptor");
+        final PluginDescriptor pluginDescr = getPluginDescriptor();
         executeIfConfigured(pluginDescr.getGroupId(), pluginDescr.getArtifactId(), QUARKUS_GENERATE_CODE_GOAL);
     }
 
+    private PluginDescriptor getPluginDescriptor() {
+        return (PluginDescriptor) getPluginContext().get("pluginDescriptor");
+    }
+
     private void triggerCompile(boolean test) throws MojoExecutionException {
         handleResources(test);
 
@@ -531,7 +534,7 @@ private void handleResources(boolean test) throws MojoExecutionException {
 
     private void executeIfConfigured(String pluginGroupId, String pluginArtifactId, String goal) throws MojoExecutionException {
         final Plugin plugin = getConfiguredPluginOrNull(pluginGroupId, pluginArtifactId);
-        if (plugin == null || plugin.getExecutions().stream().noneMatch(exec -> exec.getGoals().contains(goal))) {
+        if (!isGoalConfigured(plugin, goal)) {
             return;
         }
         getLog().info("Invoking " + plugin.getGroupId() + ":" + plugin.getArtifactId() + ":" + plugin.getVersion() + ":" + goal
@@ -550,6 +553,18 @@ private void executeIfConfigured(String pluginGroupId, String pluginArtifactId,
                         pluginManager));
     }
 
+    public boolean isGoalConfigured(Plugin plugin, String goal) {
+        if (plugin == null) {
+            return false;
+        }
+        for (PluginExecution pluginExecution : plugin.getExecutions()) {
+            if (pluginExecution.getGoals().contains(goal)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
     private Xpp3Dom getPluginConfig(Plugin plugin, String goal) throws MojoExecutionException {
         Xpp3Dom mergedConfig = null;
         if (!plugin.getExecutions().isEmpty()) {
diff --git a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/maven/utilities/MojoUtils.java b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/maven/utilities/MojoUtils.java
index 2b6a2d31f19..d999be4fd96 100644
--- a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/maven/utilities/MojoUtils.java
+++ b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/maven/utilities/MojoUtils.java
@@ -15,10 +15,8 @@
 import org.apache.maven.model.Dependency;
 import org.apache.maven.model.Model;
 import org.apache.maven.model.Plugin;
-import org.apache.maven.model.PluginExecution;
 import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
 import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
-import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.util.xml.Xpp3Dom;
 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 
@@ -188,21 +186,6 @@ public static String credentials(final Dependency d) {
         return String.format("%s:%s", d.getGroupId(), d.getArtifactId());
     }
 
-    public static Plugin checkProjectForMavenBuildPlugin(MavenProject project) {
-        for (Plugin plugin : project.getBuildPlugins()) {
-            if (plugin.getGroupId().equals("io.quarkus")
-                    && plugin.getArtifactId().equals("quarkus-maven-plugin")) {
-                for (PluginExecution pluginExecution : plugin.getExecutions()) {
-                    if (pluginExecution.getGoals().contains("build")) {
-                        return plugin;
-                    }
-                }
-            }
-        }
-
-        return null;
-    }
-
     /**
      * Element wrapper class for configuration elements
      */