Repository: quarkusio/quarkus
Issue: CLI creates kotlin project even with explicit `--java 11 --gradle-kotlin-dsl`

### Describe the bug

`quarkus create app --java 11 --gradle-kotlin-dsl` creates Kotlin project instead of java one:

```kotlin
plugins {
    kotlin("jvm") version "1.6.10"
    kotlin("plugin.allopen") version "1.6.10"
    id("io.quarkus")
}
```

### Expected behavior

Gradle scripts use Kotlin DSL but java project. 

### Actual behavior

Gradle scripts use Kotlin DSL with kotlin project.

### How to Reproduce?

Run `quarkus create app --java 11 --gradle-kotlin-dsl`

### Output of `uname -a` or `ver`

Linux unterwelt 5.17.1-arch1-1 #1 SMP PREEMPT Mon, 28 Mar 2022 20:55:33 +0000 x86_64 GNU/Linux

### Output of `java -version`

OpenJDK 64-Bit Server VM Temurin-17.0.2+8 (build 17.0.2+8, mixed mode, sharing)

### GraalVM version (if different from Java)

N/A

### Quarkus version or git rev

2.8.0.Final

### Build tool (ie. output of `mvnw --version` or `gradlew --version`)

N/A

### Additional information

_No response_

Changed files:
devtools/cli/src/main/java/io/quarkus/cli/create/TargetLanguageGroup.java, devtools/cli/src/test/java/io/quarkus/cli/CliProjectGradleTest.java

diff --git a/devtools/cli/src/main/java/io/quarkus/cli/create/TargetLanguageGroup.java b/devtools/cli/src/main/java/io/quarkus/cli/create/TargetLanguageGroup.java
index 2ac56d3063b..4248ba04c6c 100644
--- a/devtools/cli/src/main/java/io/quarkus/cli/create/TargetLanguageGroup.java
+++ b/devtools/cli/src/main/java/io/quarkus/cli/create/TargetLanguageGroup.java
@@ -44,7 +44,7 @@ public SourceType getSourceType(CommandSpec spec, BuildTool buildTool, Set<Strin
                 if (kotlin || scala) {
                     output.warn("JBang only supports Java. Using Java as the target language.");
                 }
-            } else if (kotlin || BuildTool.GRADLE_KOTLIN_DSL == buildTool) {
+            } else if (kotlin) {
                 sourceType = SourceType.KOTLIN;
             } else if (scala) {
                 sourceType = SourceType.SCALA;
diff --git a/devtools/cli/src/test/java/io/quarkus/cli/CliProjectGradleTest.java b/devtools/cli/src/test/java/io/quarkus/cli/CliProjectGradleTest.java
index ec4fe18daf7..37d84327b3f 100644
--- a/devtools/cli/src/test/java/io/quarkus/cli/CliProjectGradleTest.java
+++ b/devtools/cli/src/test/java/io/quarkus/cli/CliProjectGradleTest.java
@@ -106,7 +106,7 @@ public void testCreateAppDefaults() throws Exception {
 
         Assertions.assertTrue(project.resolve("gradlew").toFile().exists(),
                 "Wrapper should exist by default");
-        String buildGradleContent = validateBasicIdentifiers(project, CreateProjectHelper.DEFAULT_GROUP_ID,
+        String buildGradleContent = validateBasicGradleGroovyIdentifiers(project, CreateProjectHelper.DEFAULT_GROUP_ID,
                 CreateProjectHelper.DEFAULT_ARTIFACT_ID,
                 CreateProjectHelper.DEFAULT_VERSION);
         Assertions.assertTrue(buildGradleContent.contains("quarkus-resteasy"),
@@ -117,6 +117,31 @@ public void testCreateAppDefaults() throws Exception {
         CliDriver.invokeValidateBuild(project);
     }
 
+    @Test
+    public void testCreateAppDefaultsWithKotlinDSL() throws Exception {
+        CliDriver.Result result = CliDriver.execute(workspaceRoot, "create", "app", "--gradle-kotlin-dsl", "--verbose", "-e",
+                "-B");
+        Assertions.assertEquals(CommandLine.ExitCode.OK, result.exitCode, "Expected OK return code." + result);
+        Assertions.assertTrue(result.stdout.contains("SUCCESS"),
+                "Expected confirmation that the project has been created." + result);
+
+        Assertions.assertTrue(project.resolve("gradlew").toFile().exists(),
+                "Wrapper should exist by default");
+        String buildGradleContent = validateBasicGradleKotlinIdentifiers(project, CreateProjectHelper.DEFAULT_GROUP_ID,
+                CreateProjectHelper.DEFAULT_ARTIFACT_ID,
+                CreateProjectHelper.DEFAULT_VERSION);
+        Assertions.assertTrue(buildGradleContent.contains("quarkus-resteasy"),
+                "build/gradle should contain quarkus-resteasy:\\n" + buildGradleContent);
+
+        Path packagePath = wrapperRoot.resolve("src/main/java/");
+        Assertions.assertTrue(packagePath.toFile().isDirectory(),
+                "Java Source directory should exist: " + packagePath.toAbsolutePath());
+
+        CliDriver.valdiateGeneratedSourcePackage(project, "org/acme");
+
+        CliDriver.invokeValidateBuild(project);
+    }
+
     @Test
     public void testCreateAppOverrides() throws Exception {
         Path nested = workspaceRoot.resolve("cli-nested");
@@ -140,7 +165,7 @@ public void testCreateAppOverrides() throws Exception {
 
         Assertions.assertTrue(project.resolve("gradlew").toFile().exists(),
                 "Wrapper should exist by default");
-        String buildGradleContent = validateBasicIdentifiers(project, "silly", "my-project", "0.1.0");
+        String buildGradleContent = validateBasicGradleGroovyIdentifiers(project, "silly", "my-project", "0.1.0");
         Assertions.assertTrue(buildGradleContent.contains("quarkus-resteasy-reactive"),
                 "build.gradle should contain quarkus-resteasy-reactive:\\n" + buildGradleContent);
 
@@ -163,7 +188,7 @@ public void testCreateCliDefaults() throws Exception {
 
         Assertions.assertTrue(project.resolve("gradlew").toFile().exists(),
                 "Wrapper should exist by default");
-        String buildGradleContent = validateBasicIdentifiers(project, CreateProjectHelper.DEFAULT_GROUP_ID,
+        String buildGradleContent = validateBasicGradleGroovyIdentifiers(project, CreateProjectHelper.DEFAULT_GROUP_ID,
                 CreateProjectHelper.DEFAULT_ARTIFACT_ID,
                 CreateProjectHelper.DEFAULT_VERSION);
         Assertions.assertFalse(buildGradleContent.contains("quarkus-resteasy"),
@@ -374,7 +399,7 @@ public void testCreateArgJava17() throws Exception {
                 "Java 17 should be used when specified. Found:\\n" + buildGradleContent);
     }
 
-    String validateBasicIdentifiers(Path project, String group, String artifact, String version) throws Exception {
+    String validateBasicGradleGroovyIdentifiers(Path project, String group, String artifact, String version) throws Exception {
         Path buildGradle = project.resolve("build.gradle");
         Assertions.assertTrue(buildGradle.toFile().exists(),
                 "build.gradle should exist: " + buildGradle.toAbsolutePath().toString());
@@ -394,4 +419,25 @@ String validateBasicIdentifiers(Path project, String group, String artifact, Str
 
         return buildContent;
     }
+
+    String validateBasicGradleKotlinIdentifiers(Path project, String group, String artifact, String version) throws Exception {
+        Path buildGradle = project.resolve("build.gradle.kts");
+        Assertions.assertTrue(buildGradle.toFile().exists(),
+                "build.gradle.kts should exist: " + buildGradle.toAbsolutePath().toString());
+
+        String buildContent = CliDriver.readFileAsString(project, buildGradle);
+        Assertions.assertTrue(buildContent.contains("group = \\"" + group + "\\""),
+                "build.gradle.kts should include the group id:\\n" + buildContent);
+        Assertions.assertTrue(buildContent.contains("version = \\"" + version + "\\""),
+                "build.gradle.kts should include the version:\\n" + buildContent);
+
+        Path settings = project.resolve("settings.gradle.kts");
+        Assertions.assertTrue(settings.toFile().exists(),
+                "settings.gradle.kts should exist: " + settings.toAbsolutePath().toString());
+        String settingsContent = CliDriver.readFileAsString(project, settings);
+        Assertions.assertTrue(settingsContent.contains(artifact),
+                "settings.gradle.kts should include the artifact id:\\n" + settingsContent);
+
+        return buildContent;
+    }
 }