diff --git a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/codestarts/quarkus/QuarkusCodestartCatalog.java b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/codestarts/quarkus/QuarkusCodestartCatalog.java index 485dcd0e4b2829..ece6f22dcf056b 100644 --- a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/codestarts/quarkus/QuarkusCodestartCatalog.java +++ b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/codestarts/quarkus/QuarkusCodestartCatalog.java @@ -34,7 +34,6 @@ import io.quarkus.platform.descriptor.loader.json.ResourceLoader; import io.quarkus.registry.catalog.Extension; import io.quarkus.registry.catalog.ExtensionCatalog; -import io.smallrye.common.version.VersionScheme; public final class QuarkusCodestartCatalog extends GenericCodestartCatalog { @@ -77,6 +76,7 @@ public enum Tooling implements DataKey { public enum ExtensionCodestart implements DataKey { RESTEASY, + RESTEASY_REACTIVE, REST, SPRING_WEB } @@ -138,8 +138,8 @@ protected Collection select(QuarkusCodestartProjectInput projectInput .filter(c -> !isExample(c) || projectInput.getExample() == null || c.matches(projectInput.getExample())) .collect(Collectors.toCollection(ArrayList::new)); - // include default codestarts depending on the versions and the extensions being chosen or not - Optional selectedDefaultCodeStart = getSelectedDefaultCodeStart(projectInput); + // include default codestart depending on the versions and the extensions being chosen or not + Optional selectedDefaultCodeStart = Optional.ofNullable(projectInput.getDefaultCodestart()); if (projectInput.getAppContent().contains(CODE) && selectedDefaultCodeStart.isPresent() @@ -178,36 +178,6 @@ protected Collection select(QuarkusCodestartProjectInput projectInput return projectCodestarts; } - private Optional getSelectedDefaultCodeStart(QuarkusCodestartProjectInput projectInput) { - // This is very hackyish, we need a better data structure to do better - Optional quarkusBom = projectInput.getBoms().stream() - .map(ArtifactCoords::fromString) - .filter(b -> isCoreBom(b) || isPlatformBom(b) || isUniverseBom(b)) - .findFirst(); - - String bomVersion = null; - - if (quarkusBom.isPresent()) { - bomVersion = quarkusBom.get().getVersion(); - } - - if (bomVersion == null || VersionScheme.MAVEN.compare(bomVersion, "2.8") >= 0) { - if (projectInput.getExtensions().isEmpty() || - (projectInput.getExtensions().size() == 1 - && isLanguageExtension(projectInput.getExtensions().iterator().next()))) { - var defaultCodestart = projectInput.getDefaultCodestart(); - if (defaultCodestart == null) { - defaultCodestart = QuarkusCodestartCatalog.ExtensionCodestart.REST.key(); - } - return Optional.of(defaultCodestart); - } - - return Optional.empty(); - } - - return Optional.of(ExtensionCodestart.RESTEASY.key()); - } - private boolean isCoreBom(ArtifactCoords artifactCoords) { return IO_QUARKUS_GROUP_ID.equals(artifactCoords.getGroupId()) && QUARKUS_BOM.equals(artifactCoords.getArtifactId()); } diff --git a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/commands/handlers/CreateProjectCommandHandler.java b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/commands/handlers/CreateProjectCommandHandler.java index a696b9d5a56543..85d8390526eff3 100644 --- a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/commands/handlers/CreateProjectCommandHandler.java +++ b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/commands/handlers/CreateProjectCommandHandler.java @@ -252,6 +252,7 @@ private void checkMinimumJavaVersion(String javaVersionString, List e } private static String getDefaultCodestart(ExtensionCatalog catalog) { + // Recent versions of the catalog have a default-codestart in the project metadata (2.10+) var map = catalog.getMetadata(); if (map != null && !map.isEmpty()) { var projectMetadata = map.get("project"); @@ -264,6 +265,7 @@ private static String getDefaultCodestart(ExtensionCatalog catalog) { } } } - return null; + // Let's use resteasy-reactive for older versions + return "resteasy-reactive"; } }