From 9d9094996679bc21cbe4190ae26a4afeb65c1a16 Mon Sep 17 00:00:00 2001 From: Selim Dincer Date: Thu, 17 Jun 2021 10:52:01 +0200 Subject: [PATCH 01/26] add support for mutiny projects Signed-off-by: Selim Dincer --- .../io/vertx/starter/ValidationHandler.java | 4 ++ .../starter/config/ProjectConstants.java | 3 ++ .../io/vertx/starter/model/ProjectFlavor.java | 48 +++++++++++++++++++ .../io/vertx/starter/model/VertxProject.java | 10 ++++ .../starter/service/GeneratorService.java | 13 +++-- .../starter/service/MetadataHandler.java | 2 + src/main/resources/starter.json | 3 +- .../resources/templates/build.gradle.kts.ftl | 14 +++++- src/main/resources/templates/pom.xml.ftl | 23 +++++++-- src/main/resources/webroot/index.html | 9 ++++ src/main/resources/webroot/main.js | 8 +++- .../io/vertx/starter/MetadataHandlerTest.java | 1 + .../vertx/starter/ValidationHandlerTest.java | 5 ++ .../vertx/starter/service/GeneratorTest.java | 8 ++-- 14 files changed, 134 insertions(+), 17 deletions(-) create mode 100644 src/main/java/io/vertx/starter/model/ProjectFlavor.java diff --git a/src/main/java/io/vertx/starter/ValidationHandler.java b/src/main/java/io/vertx/starter/ValidationHandler.java index 79a5eb9b..e733c526 100644 --- a/src/main/java/io/vertx/starter/ValidationHandler.java +++ b/src/main/java/io/vertx/starter/ValidationHandler.java @@ -86,6 +86,10 @@ public void handle(RoutingContext rc) { return; } + if (!validateAndSetEnum(rc, FLAVOR, ProjectFlavor::fromId, vertxProject::setFlavor)) { + return; + } + String vertxVersion = getQueryParam(rc, VERTX_VERSION); if (isNotBlank(vertxVersion)) { if (!versions.contains(vertxVersion)) { diff --git a/src/main/java/io/vertx/starter/config/ProjectConstants.java b/src/main/java/io/vertx/starter/config/ProjectConstants.java index 13d2192f..9b6ffde9 100644 --- a/src/main/java/io/vertx/starter/config/ProjectConstants.java +++ b/src/main/java/io/vertx/starter/config/ProjectConstants.java @@ -29,4 +29,7 @@ public interface ProjectConstants { String ARCHIVE_FORMAT = "archiveFormat"; String PACKAGE_NAME = "packageName"; String JDK_VERSION = "jdkVersion"; + String FLAVOR = "flavor"; + String MUTINY_FLAVOR = "mutiny"; + String VERTX_FLAVOR = "vert.x"; } diff --git a/src/main/java/io/vertx/starter/model/ProjectFlavor.java b/src/main/java/io/vertx/starter/model/ProjectFlavor.java new file mode 100644 index 00000000..1db93378 --- /dev/null +++ b/src/main/java/io/vertx/starter/model/ProjectFlavor.java @@ -0,0 +1,48 @@ +package io.vertx.starter.model; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Locale; + +import static io.vertx.starter.config.ProjectConstants.MUTINY_FLAVOR; +import static io.vertx.starter.config.ProjectConstants.VERTX_FLAVOR; + +public enum ProjectFlavor { + @JsonProperty(VERTX_FLAVOR) + VERTX(VERTX_FLAVOR, "io.vertx", ""), + @JsonProperty(MUTINY_FLAVOR) + MUTINY(MUTINY_FLAVOR, "io.smallrye.reactive", "smallrye-mutiny-"); + + private final String id; + private final String groupId; + private final String artifactIdPrefix; + + ProjectFlavor(String id, String groupId, String artifactIdPrefix) { + this.id = id; + this.groupId = groupId; + this.artifactIdPrefix = artifactIdPrefix; + } + + public String getId() { + return id; + } + + public String getGroupId() { + return groupId; + } + + public String getArtifactIdPrefix() { + return artifactIdPrefix; + } + + public static ProjectFlavor fromId(String id) { + switch (id.toLowerCase(Locale.ROOT)) { + case MUTINY_FLAVOR: + return MUTINY; + case VERTX_FLAVOR: + return VERTX; + default: + return null; + } + } +} diff --git a/src/main/java/io/vertx/starter/model/VertxProject.java b/src/main/java/io/vertx/starter/model/VertxProject.java index 82e288e3..599ea6c7 100644 --- a/src/main/java/io/vertx/starter/model/VertxProject.java +++ b/src/main/java/io/vertx/starter/model/VertxProject.java @@ -33,6 +33,7 @@ public class VertxProject { private JdkVersion jdkVersion; private String operatingSystem; private Instant createdOn; + private ProjectFlavor flavor; public String getId() { return id; @@ -142,6 +143,15 @@ public VertxProject setCreatedOn(Instant createdOn) { return this; } + public ProjectFlavor getFlavor() { + return flavor; + } + + public VertxProject setFlavor(ProjectFlavor flavor) { + this.flavor = flavor; + return this; + } + @Override public String toString() { // DO NOT RETURN USER RELATED-DATA (groupId, artifactId, packageName) diff --git a/src/main/java/io/vertx/starter/service/GeneratorService.java b/src/main/java/io/vertx/starter/service/GeneratorService.java index 1a1a8411..f8f42bdc 100644 --- a/src/main/java/io/vertx/starter/service/GeneratorService.java +++ b/src/main/java/io/vertx/starter/service/GeneratorService.java @@ -21,6 +21,7 @@ import io.vertx.ext.web.templ.freemarker.FreeMarkerTemplateEngine; import io.vertx.starter.model.ArchiveFormat; import io.vertx.starter.model.Language; +import io.vertx.starter.model.ProjectFlavor; import io.vertx.starter.model.VertxProject; import org.apache.commons.compress.archivers.ArchiveEntry; import org.apache.commons.compress.archivers.ArchiveOutputStream; @@ -120,6 +121,10 @@ private void createProject(VertxProject project, TempDir tempDir) throws IOExcep Set vertxDependencies = project.getVertxDependencies(); if (vertxDependencies == null) { vertxDependencies = new HashSet<>(); + } else if (project.getFlavor() != ProjectFlavor.VERTX) { + vertxDependencies = vertxDependencies.stream() + .map(dependency -> project.getFlavor().getArtifactIdPrefix() + dependency) + .collect(toSet()); } boolean hasVertxUnit = vertxDependencies.remove("vertx-unit"); ctx.put("hasVertxUnit", hasVertxUnit); @@ -128,15 +133,15 @@ private void createProject(VertxProject project, TempDir tempDir) throws IOExcep if (hasVertxUnit && hasVertxJUnit5) { throw new RuntimeException("You cannot generate a project which depends on both vertx-unit and vertx-junit5."); } - vertxDependencies.addAll(language.getLanguageDependencies()); + ctx.put("languageDependencies", language.getLanguageDependencies()); ctx.put("vertxDependencies", vertxDependencies); + ctx.put("flavor", project.getFlavor().getId()); + ctx.put("groupId", project.getFlavor().getGroupId()); + ctx.put("artifactIdPrefix", project.getFlavor().getArtifactIdPrefix()); String packageName = packageName(project); ctx.put("packageName", packageName); ctx.put("jdkVersion", project.getJdkVersion().getValue()); - Path tempDirPath = tempDir.path(); - String tempDirPathStr = tempDirPath.toString(); - copy(tempDir, "files", "_editorconfig"); copy(tempDir, "files", "_gitignore"); diff --git a/src/main/java/io/vertx/starter/service/MetadataHandler.java b/src/main/java/io/vertx/starter/service/MetadataHandler.java index 041f4ecf..dd60a8e8 100644 --- a/src/main/java/io/vertx/starter/service/MetadataHandler.java +++ b/src/main/java/io/vertx/starter/service/MetadataHandler.java @@ -25,6 +25,7 @@ import io.vertx.starter.model.BuildTool; import io.vertx.starter.model.JdkVersion; import io.vertx.starter.model.Language; +import io.vertx.starter.model.ProjectFlavor; import java.util.Arrays; import java.util.function.Function; @@ -44,6 +45,7 @@ public MetadataHandler(JsonObject defaults, JsonArray versions, JsonArray stack) .put("buildTools", values(BuildTool.values(), BuildTool::getValue)) .put("languages", values(Language.values(), Language::getName)) .put("jdkVersions", values(JdkVersion.values(), JdkVersion::getValue)) + .put("flavors", values(ProjectFlavor.values(), ProjectFlavor::getId)) .put("vertxDependencies", stack) // deprecated .put("vertxVersions", versions.stream() // deprecated .map(JsonObject.class::cast) diff --git a/src/main/resources/starter.json b/src/main/resources/starter.json index b902712c..63590624 100644 --- a/src/main/resources/starter.json +++ b/src/main/resources/starter.json @@ -6,7 +6,8 @@ "buildTool": "maven", "vertxVersion": "4.1.0", "archiveFormat": "zip", - "jdkVersion": "11" + "jdkVersion": "11", + "flavor": "vert.x" }, "versions": [ { diff --git a/src/main/resources/templates/build.gradle.kts.ftl b/src/main/resources/templates/build.gradle.kts.ftl index d605c8fb..a5549f20 100644 --- a/src/main/resources/templates/build.gradle.kts.ftl +++ b/src/main/resources/templates/build.gradle.kts.ftl @@ -30,6 +30,9 @@ repositories { } val vertxVersion = "${vertxVersion}" +<#if flavor == "mutiny"> +val mutinyVersion = "2.6.0" + val junitJupiterVersion = "5.7.0" val mainVerticleName = "${packageName}.MainVerticle" @@ -47,14 +50,21 @@ application { dependencies { implementation(platform("io.vertx:vertx-stack-depchain:$vertxVersion")) <#if !vertxDependencies?has_content> - implementation("io.vertx:vertx-core") + implementation("${groupId}:${artifactIdPrefix}vertx-core") <#list vertxDependencies as dependency> - implementation("io.vertx:${dependency}") + <#if flavor == "mutiny"> + implementation("${groupId}:${dependency}:$mutinyVersion") + <#else> + implementation("${groupId}:${dependency}") + <#if language == "kotlin"> implementation(kotlin("stdlib-jdk8")) +<#list languageDependencies as dependency> + implementation("io.vertx:${dependency}") + <#if hasVertxJUnit5> testImplementation("io.vertx:vertx-junit5") testImplementation("org.junit.jupiter:junit-jupiter:$junitJupiterVersion") diff --git a/src/main/resources/templates/pom.xml.ftl b/src/main/resources/templates/pom.xml.ftl index 73b7698d..5b111e19 100644 --- a/src/main/resources/templates/pom.xml.ftl +++ b/src/main/resources/templates/pom.xml.ftl @@ -30,6 +30,9 @@ <#if hasVertxJUnit5> 5.7.0 +<#if flavor == "mutiny"> + 2.6.0 + ${packageName}.MainVerticle io.vertx.core.Launcher @@ -52,15 +55,23 @@ <#if !vertxDependencies?has_content> - io.vertx - vertx-core + ${groupId} + ${artifactIdPrefix}vertx-core <#list vertxDependencies as dependency> + <#if flavor == "mutiny"> - io.vertx + ${groupId} + ${dependency} + <#noparse>${mutiny.version} + + <#else> + + ${groupId} ${dependency} + <#if language == "kotlin"> <#noparse> @@ -71,6 +82,12 @@ +<#list languageDependencies as dependency> + + ${groupId} + ${dependency} + + <#if hasVertxJUnit5> diff --git a/src/main/resources/webroot/index.html b/src/main/resources/webroot/index.html index 7da54c8c..6683acaa 100644 --- a/src/main/resources/webroot/index.html +++ b/src/main/resources/webroot/index.html @@ -108,6 +108,15 @@

Create a new Vert.x application

+
+ +
+
+ +
+
+
diff --git a/src/main/resources/webroot/main.js b/src/main/resources/webroot/main.js index baf5d9d3..f3c45d44 100644 --- a/src/main/resources/webroot/main.js +++ b/src/main/resources/webroot/main.js @@ -48,7 +48,8 @@ angular vertxVersion: vertxProject.vertxVersion, vertxDependencies: vertxProject.vertxDependencies, packageName: vertxProject.packageName, - jdkVersion: vertxProject.jdkVersion + jdkVersion: vertxProject.jdkVersion, + flavor: vertxProject.flavor } }); }, @@ -80,7 +81,7 @@ angular argSeparator: "; " } }, - args: ["groupId", "artifactId", "packageName", "vertxVersion", "vertxDependencies", "language", "jdkVersion", "buildTool"] + args: ["groupId", "artifactId", "packageName", "vertxVersion", "vertxDependencies", "language", "jdkVersion", "buildTool", "flavor"] }) .filter('capitalize', function () { return function (input) { @@ -100,6 +101,7 @@ angular vm.languages = []; vm.buildTools = []; vm.jdkVersions = []; + vm.flavors = []; vm.advancedCollapsed = true; vm.isWindows = bowser.windows; @@ -169,6 +171,7 @@ angular vm.buildTools = data.buildTools; vm.languages = data.languages; vm.jdkVersions = data.jdkVersions; + vm.flavors = data.flavors; vm.selectedPanel = data.stack && data.stack.length > 0 ? data.stack[0].code : 'none'; vm.vertxVersions = data.versions.map(function (version) { return version.number; @@ -186,6 +189,7 @@ angular vm.vertxProject.vertxDependencies = []; vm.vertxProject.packageName = ""; vm.vertxProject.jdkVersion = defaults.jdkVersion; + vm.vertxProject.flavor = defaults.flavor; vm.disableDependencies(defaults.vertxVersion); refreshAvailableDependencies(defaults.vertxVersion, false); diff --git a/src/test/java/io/vertx/starter/MetadataHandlerTest.java b/src/test/java/io/vertx/starter/MetadataHandlerTest.java index d818e5bd..a86e296e 100644 --- a/src/test/java/io/vertx/starter/MetadataHandlerTest.java +++ b/src/test/java/io/vertx/starter/MetadataHandlerTest.java @@ -68,6 +68,7 @@ public void shouldReturnStarterMetadata(Vertx vertx, VertxTestContext testContex assertThat(metadata.getJsonArray("buildTools")).contains("maven", "gradle"); assertThat(metadata.getJsonArray("languages")).contains("java", "kotlin"); assertThat(metadata.getJsonArray("jdkVersions")).contains("1.8", "11", "16"); + assertThat(metadata.getJsonArray("flavors")).contains("vert.x", "mutiny"); assertThat(metadata.getJsonArray("vertxDependencies")).isEqualTo(stack); assertThat(metadata.getJsonArray("vertxVersions")).isEqualTo(versions.stream() .map(JsonObject.class::cast) diff --git a/src/test/java/io/vertx/starter/ValidationHandlerTest.java b/src/test/java/io/vertx/starter/ValidationHandlerTest.java index 76ec4856..895dd626 100644 --- a/src/test/java/io/vertx/starter/ValidationHandlerTest.java +++ b/src/test/java/io/vertx/starter/ValidationHandlerTest.java @@ -136,6 +136,11 @@ void testUnknownJdkVersion(Vertx vertx, VertxTestContext testContext) { expectFailure(vertx, testContext, validator, params.add(JDK_VERSION, "9"), ZIP.getFileExtension(), JDK_VERSION); } + @Test + void testUnknownFlavor(Vertx vertx, VertxTestContext testContext) { + expectFailure(vertx, testContext, validator, params.add(FLAVOR, "RxJava"), ZIP.getFileExtension(), JDK_VERSION); + } + @Test void testTwoJunitVersions(Vertx vertx, VertxTestContext testContext) { MultiMap params = this.params.add(VERTX_DEPENDENCIES, "vertx-unit,vertx-junit5"); diff --git a/src/test/java/io/vertx/starter/service/GeneratorTest.java b/src/test/java/io/vertx/starter/service/GeneratorTest.java index 1904a7fb..3d50ab74 100644 --- a/src/test/java/io/vertx/starter/service/GeneratorTest.java +++ b/src/test/java/io/vertx/starter/service/GeneratorTest.java @@ -32,10 +32,7 @@ import io.vertx.starter.Util; import io.vertx.starter.VertxProjectCodec; import io.vertx.starter.config.Topics; -import io.vertx.starter.model.BuildTool; -import io.vertx.starter.model.JdkVersion; -import io.vertx.starter.model.Language; -import io.vertx.starter.model.VertxProject; +import io.vertx.starter.model.*; import org.apache.commons.compress.archivers.tar.TarArchiveEntry; import org.apache.commons.compress.archivers.tar.TarArchiveInputStream; import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream; @@ -123,7 +120,8 @@ static VertxProject defaultProject() { .setBuildTool(MAVEN) .setVertxVersion("4.1.0") .setArchiveFormat(TGZ) - .setJdkVersion(JdkVersion.JDK_1_8); + .setJdkVersion(JdkVersion.JDK_1_8) + .setFlavor(ProjectFlavor.VERTX); } @ParameterizedTest From 647c80f1f900fee618123b9eadf76162e1ecc935 Mon Sep 17 00:00:00 2001 From: Selim Dincer Date: Sun, 20 Jun 2021 16:26:05 +0200 Subject: [PATCH 02/26] add separate stack for mutiny Signed-off-by: Selim Dincer --- .../io/vertx/starter/ValidationHandler.java | 54 +- .../java/io/vertx/starter/WebVerticle.java | 7 +- .../io/vertx/starter/model/Dependency.java | 47 ++ .../io/vertx/starter/model/VertxProject.java | 6 +- .../starter/service/GeneratorService.java | 14 +- .../starter/service/MetadataHandler.java | 7 +- src/main/resources/starter.json | 621 +++++++++++++++++- .../resources/templates/build.gradle.kts.ftl | 12 +- src/main/resources/templates/pom.xml.ftl | 24 +- .../io/vertx/starter/MetadataHandlerTest.java | 10 +- .../vertx/starter/ValidationHandlerTest.java | 19 +- .../vertx/starter/service/GeneratorTest.java | 7 +- 12 files changed, 776 insertions(+), 52 deletions(-) create mode 100644 src/main/java/io/vertx/starter/model/Dependency.java diff --git a/src/main/java/io/vertx/starter/ValidationHandler.java b/src/main/java/io/vertx/starter/ValidationHandler.java index e733c526..80db155d 100644 --- a/src/main/java/io/vertx/starter/ValidationHandler.java +++ b/src/main/java/io/vertx/starter/ValidationHandler.java @@ -43,9 +43,10 @@ public class ValidationHandler implements Handler { private final JsonObject defaults; private final Set versions; private final Map> exclusions; - private final Set dependencies; + private final Map vertxStackDependencies; + private final Map mutinyStackDependencies; - public ValidationHandler(JsonObject defaults, JsonArray versions, JsonArray stack) { + public ValidationHandler(JsonObject defaults, JsonArray versions, JsonArray vertxStack, JsonArray mutinyStack) { this.defaults = defaults; this.versions = versions.stream() .map(JsonObject.class::cast) @@ -57,12 +58,26 @@ public ValidationHandler(JsonObject defaults, JsonArray versions, JsonArray stac obj -> obj.getString("number"), obj -> obj.getJsonArray("exclusions", new JsonArray()).stream().map(String.class::cast).collect(toList())) ); - dependencies = stack.stream() + vertxStackDependencies = vertxStack.stream() .map(JsonObject.class::cast) .flatMap(category -> category.getJsonArray("items").stream()) .map(JsonObject.class::cast) - .map(item -> item.getString("artifactId")) - .collect(toSet()); + .collect(toMap( + item -> item.getString("artifactId"), + item -> new Dependency() + .setGroupId(item.getString("groupId")) + .setArtifactId(item.getString("artifactId"))) + ); + mutinyStackDependencies = mutinyStack.stream() + .map(JsonObject.class::cast) + .flatMap(category -> category.getJsonArray("items").stream()) + .map(JsonObject.class::cast) + .collect(toMap( + item -> item.getString("artifactId"), + item -> new Dependency() + .setGroupId(item.getString("groupId")) + .setArtifactId(item.getString("artifactId"))) + ); } @Override @@ -107,7 +122,16 @@ public void handle(RoutingContext rc) { .map(String::toLowerCase) .collect(toSet()); - if (!dependencies.containsAll(vertxDependencies) || + Set stackDependencies; + if (vertxProject.getFlavor() == ProjectFlavor.VERTX) { + stackDependencies = vertxStackDependencies.keySet(); + } else if (vertxProject.getFlavor() == ProjectFlavor.MUTINY) { + stackDependencies = mutinyStackDependencies.keySet(); + } else { + throw new IllegalArgumentException("There's no stack for flavor " + vertxProject.getFlavor()); + } + + if (vertxProject.getFlavor() == ProjectFlavor.VERTX && !stackDependencies.containsAll(vertxDependencies) || !Collections.disjoint(exclusions.get(vertxProject.getVertxVersion()), vertxDependencies)) { fail(rc, VERTX_DEPENDENCIES, deps); return; @@ -118,7 +142,23 @@ public void handle(RoutingContext rc) { return; } - vertxProject.setVertxDependencies(vertxDependencies); + Set flavoredDependencies = new HashSet<>(vertxDependencies.size()); + if (vertxProject.getFlavor() == ProjectFlavor.VERTX) { + flavoredDependencies = vertxDependencies.stream() + .map(vertxStackDependencies::get) + .collect(toSet()); + } else if (vertxProject.getFlavor() == ProjectFlavor.MUTINY) { + flavoredDependencies = vertxDependencies.stream() + .map(dependency -> mutinyStackDependencies.keySet().stream() + .filter(mutinyDependency -> mutinyDependency.endsWith(dependency)) + .findFirst()) + .filter(Optional::isPresent) + .map(Optional::get) + .map(mutinyStackDependencies::get) + .collect(toSet()); + } + + vertxProject.setVertxDependencies(flavoredDependencies); } ArchiveFormat archiveFormat = ArchiveFormat.fromFilename(rc.request().path()); diff --git a/src/main/java/io/vertx/starter/WebVerticle.java b/src/main/java/io/vertx/starter/WebVerticle.java index 2effda31..b2aa397e 100644 --- a/src/main/java/io/vertx/starter/WebVerticle.java +++ b/src/main/java/io/vertx/starter/WebVerticle.java @@ -56,11 +56,12 @@ public WebVerticle() { JsonObject defaults = starterData.getJsonObject("defaults"); JsonArray versions = starterData.getJsonArray("versions"); - JsonArray stack = starterData.getJsonArray("stack"); + JsonArray vertxStack = starterData.getJsonArray("vertxStack"); + JsonArray mutinyStack = starterData.getJsonArray("mutinyStack"); - validationHandler = new ValidationHandler(defaults, versions, stack); + validationHandler = new ValidationHandler(defaults, versions, vertxStack, mutinyStack); generationHandler = new GenerationHandler(); - metadataHandler = new MetadataHandler(defaults, versions, stack); + metadataHandler = new MetadataHandler(defaults, versions, vertxStack, mutinyStack); } catch (IOException e) { throw new RuntimeException(e); diff --git a/src/main/java/io/vertx/starter/model/Dependency.java b/src/main/java/io/vertx/starter/model/Dependency.java new file mode 100644 index 00000000..21c006d3 --- /dev/null +++ b/src/main/java/io/vertx/starter/model/Dependency.java @@ -0,0 +1,47 @@ +package io.vertx.starter.model; + +import java.util.Objects; + +public class Dependency { + private String groupId; + private String artifactId; + + public String getGroupId() { + return groupId; + } + + public Dependency setGroupId(String groupId) { + this.groupId = groupId; + return this; + } + + public String getArtifactId() { + return artifactId; + } + + public Dependency setArtifactId(String artifactId) { + this.artifactId = artifactId; + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Dependency that = (Dependency) o; + return Objects.equals(groupId, that.groupId) && Objects.equals(artifactId, that.artifactId); + } + + @Override + public int hashCode() { + return Objects.hash(groupId, artifactId); + } + + @Override + public String toString() { + return "Dependency{" + + "groupId='" + groupId + '\'' + + ", artifactId='" + artifactId + '\'' + + '}'; + } +} diff --git a/src/main/java/io/vertx/starter/model/VertxProject.java b/src/main/java/io/vertx/starter/model/VertxProject.java index 599ea6c7..a8995522 100644 --- a/src/main/java/io/vertx/starter/model/VertxProject.java +++ b/src/main/java/io/vertx/starter/model/VertxProject.java @@ -27,7 +27,7 @@ public class VertxProject { private Language language; private BuildTool buildTool; private String vertxVersion; - private Set vertxDependencies; + private Set vertxDependencies; private ArchiveFormat archiveFormat; private String packageName; private JdkVersion jdkVersion; @@ -89,11 +89,11 @@ public VertxProject setVertxVersion(String vertxVersion) { return this; } - public Set getVertxDependencies() { + public Set getVertxDependencies() { return vertxDependencies; } - public VertxProject setVertxDependencies(Set vertxDependencies) { + public VertxProject setVertxDependencies(Set vertxDependencies) { this.vertxDependencies = vertxDependencies; return this; } diff --git a/src/main/java/io/vertx/starter/service/GeneratorService.java b/src/main/java/io/vertx/starter/service/GeneratorService.java index f8f42bdc..f7ad518f 100644 --- a/src/main/java/io/vertx/starter/service/GeneratorService.java +++ b/src/main/java/io/vertx/starter/service/GeneratorService.java @@ -20,8 +20,8 @@ import io.vertx.core.buffer.Buffer; import io.vertx.ext.web.templ.freemarker.FreeMarkerTemplateEngine; import io.vertx.starter.model.ArchiveFormat; +import io.vertx.starter.model.Dependency; import io.vertx.starter.model.Language; -import io.vertx.starter.model.ProjectFlavor; import io.vertx.starter.model.VertxProject; import org.apache.commons.compress.archivers.ArchiveEntry; import org.apache.commons.compress.archivers.ArchiveOutputStream; @@ -118,17 +118,15 @@ private void createProject(VertxProject project, TempDir tempDir) throws IOExcep Language language = project.getLanguage(); ctx.put("language", language.name().toLowerCase()); ctx.put("vertxVersion", project.getVertxVersion()); - Set vertxDependencies = project.getVertxDependencies(); + Set vertxDependencies = project.getVertxDependencies(); if (vertxDependencies == null) { vertxDependencies = new HashSet<>(); - } else if (project.getFlavor() != ProjectFlavor.VERTX) { - vertxDependencies = vertxDependencies.stream() - .map(dependency -> project.getFlavor().getArtifactIdPrefix() + dependency) - .collect(toSet()); } - boolean hasVertxUnit = vertxDependencies.remove("vertx-unit"); + boolean hasVertxUnit = vertxDependencies + .removeIf(dependency -> dependency.getArtifactId().equals("vertx-unit")); ctx.put("hasVertxUnit", hasVertxUnit); - boolean hasVertxJUnit5 = vertxDependencies.remove("vertx-junit5") || !hasVertxUnit; + boolean hasVertxJUnit5 = vertxDependencies + .removeIf(dependency -> dependency.getArtifactId().equals("vertx-junit5")) || !hasVertxUnit; ctx.put("hasVertxJUnit5", hasVertxJUnit5); if (hasVertxUnit && hasVertxJUnit5) { throw new RuntimeException("You cannot generate a project which depends on both vertx-unit and vertx-junit5."); diff --git a/src/main/java/io/vertx/starter/service/MetadataHandler.java b/src/main/java/io/vertx/starter/service/MetadataHandler.java index dd60a8e8..ca1d04ec 100644 --- a/src/main/java/io/vertx/starter/service/MetadataHandler.java +++ b/src/main/java/io/vertx/starter/service/MetadataHandler.java @@ -37,16 +37,17 @@ public class MetadataHandler implements Handler { private final Buffer metadata; - public MetadataHandler(JsonObject defaults, JsonArray versions, JsonArray stack) { + public MetadataHandler(JsonObject defaults, JsonArray versions, JsonArray vertxStack, JsonArray mutinyStack) { metadata = new JsonObject() .put("defaults", defaults) .put("versions", versions) - .put("stack", stack) + .put("stack", vertxStack) .put("buildTools", values(BuildTool.values(), BuildTool::getValue)) .put("languages", values(Language.values(), Language::getName)) .put("jdkVersions", values(JdkVersion.values(), JdkVersion::getValue)) .put("flavors", values(ProjectFlavor.values(), ProjectFlavor::getId)) - .put("vertxDependencies", stack) // deprecated + .put("vertxDependencies", vertxStack) // deprecated + .put("mutinyDependencies", mutinyStack) // deprecated .put("vertxVersions", versions.stream() // deprecated .map(JsonObject.class::cast) .map(obj -> obj.getString("number")) diff --git a/src/main/resources/starter.json b/src/main/resources/starter.json index 63590624..2e516df9 100644 --- a/src/main/resources/starter.json +++ b/src/main/resources/starter.json @@ -48,81 +48,98 @@ ] } ], - "stack": [ + "vertxStack": [ { "code": "web", "category": "Web", "items": [ { + "groupId": "io.vertx", "artifactId": "vertx-web", "name": "Vert.x Web", "description": "Vert.x-Web is a tool-kit for writing sophisticated modern web applications and HTTP microservices." }, { + "groupId": "io.vertx", "artifactId": "vertx-web-client", "name": "Vert.x Web Client", "description": "Vert.x Web Client is an easy to use advanced HTTP client." }, { + "groupId": "io.vertx", "artifactId": "vertx-web-graphql", "name": "Web GraphQL Handler", "description": "Create GraphQL servers with Vert.x Web and the GraphQL-Java library." }, { + "groupId": "io.vertx", "artifactId": "vertx-web-api-contract", "name": "Web API Contract", "description": "Web API Contract supports OpenApi 3 specification for a design first approach and provides a validation framework." }, { + "groupId": "io.vertx", "artifactId": "vertx-web-templ-thymeleaf", "name": "Thymeleaf template engine" }, { + "groupId": "io.vertx", "artifactId": "vertx-web-templ-handlebars", "name": "Handlebars template engine" }, { + "groupId": "io.vertx", "artifactId": "vertx-web-templ-jade", "name": "Jade template engine" }, { + "groupId": "io.vertx", "artifactId": "vertx-web-templ-mvel", "name": "MVEL template engine" }, { + "groupId": "io.vertx", "artifactId": "vertx-web-templ-pebble", "name": "Pebble template engine" }, { + "groupId": "io.vertx", "artifactId": "vertx-web-templ-freemarker", "name": "Apache FreeMarker template engine" }, { + "groupId": "io.vertx", "artifactId": "vertx-web-templ-rocker", "name": "Rocker template engine" }, { + "groupId": "io.vertx", "artifactId": "vertx-web-templ-httl", "name": "HTTL template engine" }, { + "groupId": "io.vertx", "artifactId": "vertx-web-sstore-cookie", "name": "Cookie session storage" }, { + "groupId": "io.vertx", "artifactId": "vertx-web-sstore-redis", "name": "Redis session storage" }, { + "groupId": "io.vertx", "artifactId": "vertx-web-sstore-infinispan", "name": "Session storage with Infinispan Client" }, { + "groupId": "io.vertx", "artifactId": "vertx-web-validation", "name": "Web Validation", "description": "A library to declaratively parse and validate incoming Vert.x Web HTTP requests." }, { + "groupId": "io.vertx", "artifactId": "vertx-web-openapi", "name": "Web OpenAPI", "description": "Extends Vert.x Web to support OpenAPI 3, bringing a simple interface for building web routers that conform to OpenAPI contracts." @@ -135,38 +152,47 @@ "description": "Vert.x provides a few different asynchronous clients for accessing various data stores from your application. You don't have to use these clients - you could use clients direct from the vendor if you prefer (e.g. MongoDB provide their own cool async and reactive clients), but these provide a simple async API which is available in various languages.", "items": [ { + "groupId": "io.vertx", "artifactId": "vertx-pg-client", "name": "Reactive PostgreSQL client" }, { + "groupId": "io.vertx", "artifactId": "vertx-mysql-client", "name": "Reactive MySQL client" }, { + "groupId": "io.vertx", "artifactId": "vertx-db2-client", "name": "Reactive DB2 client" }, { + "groupId": "io.vertx", "artifactId": "vertx-mssql-client", "name": "Reactive MSSQL client" }, { + "groupId": "io.vertx", "artifactId": "vertx-mongo-client", "name": "MongoDB client" }, { + "groupId": "io.vertx", "artifactId": "vertx-jdbc-client", "name": "JDBC client" }, { + "groupId": "io.vertx", "artifactId": "vertx-redis-client", "name": "Redis client" }, { + "groupId": "io.vertx", "artifactId": "vertx-cassandra-client", "name": "Cassandra client" }, { + "groupId": "io.vertx", "artifactId": "vertx-sql-client-templates", "name": "SQL Client Templates", "description": "A small library designed to facilitate the execution and data manipulation of SQL queries." @@ -179,31 +205,37 @@ "description": "Vert.x provides a few components to make your applications more reactive.", "items": [ { + "groupId": "io.vertx", "artifactId": "vertx-rx-java", "name": "Vert.x RxJava v1", "description": "Vert.x API for RxJava 1." }, { + "groupId": "io.vertx", "artifactId": "vertx-rx-java2", "name": "Vert.x RxJava v2", "description": "Vert.x API for RxJava 2." }, { + "groupId": "io.vertx", "artifactId": "vertx-rx-java3", "name": "Vert.x RxJava v3", "description": "Vert.x API for RxJava 3." }, { + "groupId": "io.vertx", "artifactId": "vertx-reactive-streams", "name": "Reactive streams", "description": "Vert.x supports reactive streams so your applications can interoperate with other reactive systems such as Akka or Project Reactor." }, { + "groupId": "io.vertx", "artifactId": "vertx-sync", "name": "Vert.x Sync", "description": "Vertx-sync allows you to deploy verticles that run using fibers. Fibers are very lightweight threads that can be blocked without blocking a kernel thread. This enables you to write your verticle code in a familiar synchronous style." }, { + "groupId": "io.vertx", "artifactId": "vertx-lang-kotlin-coroutines", "name": "Vert.x Kotlin coroutines", "description": "Kotlin coroutines for Vert.x, gives you super powers such as async/await or Go-like channels. This enables you to write your verticle code in a familiar sequential style." @@ -216,16 +248,19 @@ "description": "Vert.x offers various component to build microservice-based applications.", "items": [ { + "groupId": "io.vertx", "artifactId": "vertx-service-discovery", "name": "Vert.x Service Discovery", "description": "This component lets you publish, lookup and bind to any type of services." }, { + "groupId": "io.vertx", "artifactId": "vertx-circuit-breaker", "name": "Vert.x Circuit Breaker", "description": "This component provides an implementation of the circuit breaker pattern for Vert.x" }, { + "groupId": "io.vertx", "artifactId": "vertx-config", "name": "Vert.x Config", "description": "This component provides an extensible way to configure Vert.x applications." @@ -237,6 +272,7 @@ "category": "IoT", "items": [ { + "groupId": "io.vertx", "artifactId": "vertx-mqtt", "name": "MQTT", "description": "Vert.x MQTT (client and server) is able to handle connections, communication and messages exchange with remote MQTT clients. Its API provides a bunch of events related to protocol messages received by clients and exposes allow to send messages to them." @@ -249,56 +285,67 @@ "description": "Vert.x provides simple APIs for auth in your applications. We also provide a few out of the box implementations.", "items": [ { + "groupId": "io.vertx", "artifactId": "vertx-auth-jdbc", "name": "JDBC auth", "description": "Auth implementation backed by JDBC" }, { + "groupId": "io.vertx", "artifactId": "vertx-auth-jwt", "name": "JWT auth", "description": "Auth implementation using JSON web tokens (JWT)" }, { + "groupId": "io.vertx", "artifactId": "vertx-auth-shiro", "name": "Shiro auth", "description": "Auth implementation using Apache Shiro" }, { + "groupId": "io.vertx", "artifactId": "vertx-auth-mongo", "name": "MongoDB auth", "description": "Auth implementation using MongoDB" }, { + "groupId": "io.vertx", "artifactId": "vertx-auth-oauth2", "name": "OAuth 2", "description": "Auth implementation for OAuth2" }, { + "groupId": "io.vertx", "artifactId": "vertx-auth-htdigest", "name": ".htdigest Auth", "description": "Authentication and authorization support based on .htdigest files." }, { + "groupId": "io.vertx", "artifactId": "vertx-auth-properties", "name": "Properties Auth", "description": "Authentication and authorization support based on Java properties files." }, { + "groupId": "io.vertx", "artifactId": "vertx-auth-ldap", "name": "LDAP Auth", "description": "Implementation using JDK built-in LDAP capabilities." }, { + "groupId": "io.vertx", "artifactId": "vertx-auth-webauthn", "name": "Webauthn Auth", "description": "FIDO2 WebAuthn (password-less) implementation." }, { + "groupId": "io.vertx", "artifactId": "vertx-auth-htpasswd", "name": ".htpasswd Auth", "description": "Authentication and authorization support based on .htpasswd files." }, { + "groupId": "io.vertx", "artifactId": "vertx-auth-sql-client", "name": "Sql Client Auth", "description": "Authentication and authorization support based on the Vert.x SQL client and a relational database." @@ -310,21 +357,25 @@ "category": "Messaging", "items": [ { + "groupId": "io.vertx", "artifactId": "vertx-amqp-client", "name": "AMQP Client", "description": "A client for interacting with an AMQP 1.0 broker or router." }, { + "groupId": "io.vertx", "artifactId": "vertx-stomp", "name": "STOMP Client and Server", "description": "Vert.x provides an implementation of the STOMP protocol." }, { + "groupId": "io.vertx", "artifactId": "vertx-rabbitmq-client", "name": "RabbitMQ Client", "description": "A client to interact with RabbitMQ." }, { + "groupId": "io.vertx", "artifactId": "vertx-amqp-bridge", "name": "AMQP Bridge", "description": "A bridge for interacting with an AMQP 1.0 broker or router." @@ -336,21 +387,25 @@ "category": "Integration", "items": [ { + "groupId": "io.vertx", "artifactId": "vertx-mail-client", "name": "Mail Client", "description": "Vert.x provides a simple SMTP mail client so you can send emails from your applications." }, { + "groupId": "io.vertx", "artifactId": "vertx-jca", "name": "JCA Adaptor", "description": "Vert.x provides a Java Connector Architecture (JCA) adaptor which allows it to interoperate with any JavaEE application server." }, { + "groupId": "io.vertx", "artifactId": "vertx-kafka-client", "name": "Kafka Client", "description": "A client to interact with Apache Kafka." }, { + "groupId": "io.vertx", "artifactId": "vertx-consul-client", "name": "Consul Client", "description": "A client to interact with Consul." @@ -363,11 +418,13 @@ "description": "Vert.x offers various bridges to extend the Event Bus beyond the JVM", "items": [ { + "groupId": "io.vertx", "artifactId": "vertx-tcp-eventbus-bridge", "name": "TCP Eventbus Bridge", "description": "An eventbus bridge that lets you interact with Vert.x from any application thanks to a TCP socket." }, { + "groupId": "io.vertx", "artifactId": "vertx-camel-bridge", "name": "Camel Bridge", "description": "An eventbus bridge that lets you interact with Apache Camel endpoints and routes" @@ -380,31 +437,37 @@ "description": "Vert.x offers various component to keep your Vert.x application on track when running in production", "items": [ { + "groupId": "io.vertx", "artifactId": "vertx-dropwizard-metrics", "name": "Metrics using Dropwizard", "description": "This component captures metrics from Vert.x core components and exposes them using Dropwizard." }, { + "groupId": "io.vertx", "artifactId": "vertx-micrometer-metrics", "name": "Metrics using Micrometer", "description": "This component captures metrics from Vert.x core components and exposes them using Micrometer." }, { + "groupId": "io.vertx", "artifactId": "vertx-health-check", "name": "Vert.x Health Check", "description": "This component provides a simple way to expose health checks." }, { + "groupId": "io.vertx", "artifactId": "vertx-zipkin", "name": "Tracing using Zipkin", "description": "Distributed tracing with Zipkin." }, { + "groupId": "io.vertx", "artifactId": "vertx-opentracing", "name": "Tracing using OpenTracing", "description": "Distributed tracing with OpenTracing." }, { + "groupId": "io.vertx", "artifactId": "vertx-opentelemetry", "name": "Tracing using OpenTelemetry", "description": "Distributed tracing with OpenTelemetry." @@ -417,10 +480,12 @@ "description": "Vert.x-Unit is an unit testing tool-kit especially design to work well with asynchronous code.", "items": [ { + "groupId": "io.vertx", "name": "Vert.x Unit", "artifactId": "vertx-unit" }, { + "groupId": "io.vertx", "name": "Vert.x JUnit5", "artifactId": "vertx-junit5" } @@ -432,21 +497,25 @@ "description": "Vert.x supports clustering and HA out of the box. Cluster group management is implemented in cluster managers which are pluggable.", "items": [ { + "groupId": "io.vertx", "name": "Hazelcast Cluster Manager", "artifactId": "vertx-hazelcast", "description": "Cluster manager implementation that uses Hazelcast." }, { + "groupId": "io.vertx", "name": "Infinispan Cluster Manager", "artifactId": "vertx-infinispan", "description": "Cluster manager implementation that uses Infinispan." }, { + "groupId": "io.vertx", "name": "Apache Ignite Cluster Manager", "artifactId": "vertx-ignite", "description": "Cluster manager implementation that uses Apache Ignite." }, { + "groupId": "io.vertx", "name": "Apache Zookeper Cluster Manager", "artifactId": "vertx-zookeeper", "description": "Cluster manager implementation that uses Apache Zookeeper." @@ -459,31 +528,37 @@ "description": "Vert.x services are a simple and effective way to encapsulate reusable functionality for use elsewhere. Services are deployed using a service identifier which decouples the user from details of the implementation.", "items": [ { + "groupId": "io.vertx", "name": "Service Proxies", "artifactId": "vertx-service-proxy", "description": "Proxies allow remote event bus services to be called as if they were local." }, { + "groupId": "io.vertx", "name": "SockJS Service Proxies", "artifactId": "vertx-sockjs-service-proxy", "description": "Allow event bus services to be called from JavaScript (browser or Node.js)." }, { + "groupId": "io.vertx", "name": "gRPC", "artifactId": "vertx-grpc", "description": "Implement gRPC Clients and Servers for Vert.x." }, { + "groupId": "io.vertx", "name": "Service Factories", "artifactId": "vertx-service-factory", "description": "How to package and deploy Vert.x independent services." }, { + "groupId": "io.vertx", "name": "Maven Service Factory", "artifactId": "vertx-maven-service-factory", "description": "This lets you dynamically install and deploy services from Maven at run-time." }, { + "groupId": "io.vertx", "name": "HTTP Service Factory", "artifactId": "vertx-http-service-factory", "description": "This lets you dynamically install and deploy services from an HTTP server (for example Bintray at run-time." @@ -495,6 +570,7 @@ "category": "Standards", "items": [ { + "groupId": "io.vertx", "artifactId": "vertx-json-schema", "name": "JSON Schema", "description": "An extensible implementation of the Json Schema specification to validate every JSON data structure, asynchronously." @@ -506,11 +582,554 @@ "category": "Devops", "items": [ { + "groupId": "io.vertx", "artifactId": "vertx-shell", "name": "Shell", "description": "This component lets you interact with your Vert.x application using a CLI interface." } ] } + ], + "mutinyStack": [ + { + "code": "web", + "category": "Web", + "items": [ + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-web", + "name": "Vert.x Web", + "description": "Vert.x-Web is a tool-kit for writing sophisticated modern web applications and HTTP microservices." + }, + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-web-client", + "name": "Vert.x Web Client", + "description": "Vert.x Web Client is an easy to use advanced HTTP client." + }, + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-web-graphql", + "name": "Web GraphQL Handler", + "description": "Create GraphQL servers with Vert.x Web and the GraphQL-Java library." + }, + { + "groupId": "io.vertx", + "artifactId": "vertx-web-api-contract", + "name": "Web API Contract", + "description": "Web API Contract supports OpenApi 3 specification for a design first approach and provides a validation framework." + }, + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-web-templ-thymeleaf", + "name": "Thymeleaf template engine" + }, + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-web-templ-handlebars", + "name": "Handlebars template engine" + }, + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-web-templ-jade", + "name": "Jade template engine" + }, + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-web-templ-mvel", + "name": "MVEL template engine" + }, + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-web-templ-pebble", + "name": "Pebble template engine" + }, + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-web-templ-freemarker", + "name": "Apache FreeMarker template engine" + }, + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-web-templ-rocker", + "name": "Rocker template engine" + }, + { + "groupId": "io.vertx", + "artifactId": "vertx-web-templ-httl", + "name": "HTTL template engine" + }, + { + "groupId": "io.vertx", + "artifactId": "vertx-web-sstore-cookie", + "name": "Cookie session storage" + }, + { + "groupId": "io.vertx", + "artifactId": "vertx-web-sstore-redis", + "name": "Redis session storage" + }, + { + "groupId": "io.vertx", + "artifactId": "vertx-web-sstore-infinispan", + "name": "Session storage with Infinispan Client" + }, + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-web-validation", + "name": "Web Validation", + "description": "A library to declaratively parse and validate incoming Vert.x Web HTTP requests." + }, + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-web-openapi", + "name": "Web OpenAPI", + "description": "Extends Vert.x Web to support OpenAPI 3, bringing a simple interface for building web routers that conform to OpenAPI contracts." + } + ] + }, + { + "code": "dataaccess", + "category": "Data Access", + "description": "Vert.x provides a few different asynchronous clients for accessing various data stores from your application. You don't have to use these clients - you could use clients direct from the vendor if you prefer (e.g. MongoDB provide their own cool async and reactive clients), but these provide a simple async API which is available in various languages.", + "items": [ + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-pg-client", + "name": "Reactive PostgreSQL client" + }, + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-mysql-client", + "name": "Reactive MySQL client" + }, + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-db2-client", + "name": "Reactive DB2 client" + }, + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-mssql-client", + "name": "Reactive MSSQL client" + }, + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-mongo-client", + "name": "MongoDB client" + }, + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-jdbc-client", + "name": "JDBC client" + }, + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-redis-client", + "name": "Redis client" + }, + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-cassandra-client", + "name": "Cassandra client" + }, + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-sql-client-templates", + "name": "SQL Client Templates", + "description": "A small library designed to facilitate the execution and data manipulation of SQL queries." + } + ] + }, + { + "code": "reactive", + "category": "Reactive", + "description": "Vert.x provides a few components to make your applications more reactive.", + "items": [ + { + "groupId": "io.vertx", + "artifactId": "vertx-rx-java", + "name": "Vert.x RxJava v1", + "description": "Vert.x API for RxJava 1." + }, + { + "groupId": "io.vertx", + "artifactId": "vertx-rx-java2", + "name": "Vert.x RxJava v2", + "description": "Vert.x API for RxJava 2." + }, + { + "groupId": "io.vertx", + "artifactId": "vertx-rx-java3", + "name": "Vert.x RxJava v3", + "description": "Vert.x API for RxJava 3." + }, + { + "groupId": "io.vertx", + "artifactId": "vertx-reactive-streams", + "name": "Reactive streams", + "description": "Vert.x supports reactive streams so your applications can interoperate with other reactive systems such as Akka or Project Reactor." + }, + { + "groupId": "io.vertx", + "artifactId": "vertx-sync", + "name": "Vert.x Sync", + "description": "Vertx-sync allows you to deploy verticles that run using fibers. Fibers are very lightweight threads that can be blocked without blocking a kernel thread. This enables you to write your verticle code in a familiar synchronous style." + }, + { + "groupId": "io.vertx", + "artifactId": "vertx-lang-kotlin-coroutines", + "name": "Vert.x Kotlin coroutines", + "description": "Kotlin coroutines for Vert.x, gives you super powers such as async/await or Go-like channels. This enables you to write your verticle code in a familiar sequential style." + } + ] + }, + { + "code": "microservices", + "category": "Microservices", + "description": "Vert.x offers various component to build microservice-based applications.", + "items": [ + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-service-discovery", + "name": "Vert.x Service Discovery", + "description": "This component lets you publish, lookup and bind to any type of services." + }, + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-circuit-breaker", + "name": "Vert.x Circuit Breaker", + "description": "This component provides an implementation of the circuit breaker pattern for Vert.x" + }, + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-config", + "name": "Vert.x Config", + "description": "This component provides an extensible way to configure Vert.x applications." + } + ] + }, + { + "code": "iot", + "category": "IoT", + "items": [ + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-mqtt", + "name": "MQTT", + "description": "Vert.x MQTT (client and server) is able to handle connections, communication and messages exchange with remote MQTT clients. Its API provides a bunch of events related to protocol messages received by clients and exposes allow to send messages to them." + } + ] + }, + { + "code": "auth", + "category": "Authentication and Authorisation", + "description": "Vert.x provides simple APIs for auth in your applications. We also provide a few out of the box implementations.", + "items": [ + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-auth-jdbc", + "name": "JDBC auth", + "description": "Auth implementation backed by JDBC" + }, + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-auth-jwt", + "name": "JWT auth", + "description": "Auth implementation using JSON web tokens (JWT)" + }, + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-auth-shiro", + "name": "Shiro auth", + "description": "Auth implementation using Apache Shiro" + }, + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-auth-mongo", + "name": "MongoDB auth", + "description": "Auth implementation using MongoDB" + }, + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-auth-oauth2", + "name": "OAuth 2", + "description": "Auth implementation for OAuth2" + }, + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-auth-htdigest", + "name": ".htdigest Auth", + "description": "Authentication and authorization support based on .htdigest files." + }, + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-auth-properties", + "name": "Properties Auth", + "description": "Authentication and authorization support based on Java properties files." + }, + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-auth-ldap", + "name": "LDAP Auth", + "description": "Implementation using JDK built-in LDAP capabilities." + }, + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-auth-webauthn", + "name": "Webauthn Auth", + "description": "FIDO2 WebAuthn (password-less) implementation." + }, + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-auth-htpasswd", + "name": ".htpasswd Auth", + "description": "Authentication and authorization support based on .htpasswd files." + }, + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-auth-sql-client", + "name": "Sql Client Auth", + "description": "Authentication and authorization support based on the Vert.x SQL client and a relational database." + } + ] + }, + { + "code": "messaging", + "category": "Messaging", + "items": [ + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-amqp-client", + "name": "AMQP Client", + "description": "A client for interacting with an AMQP 1.0 broker or router." + }, + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-stomp", + "name": "STOMP Client and Server", + "description": "Vert.x provides an implementation of the STOMP protocol." + }, + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-rabbitmq-client", + "name": "RabbitMQ Client", + "description": "A client to interact with RabbitMQ." + }, + { + "groupId": "io.vertx", + "artifactId": "vertx-amqp-bridge", + "name": "AMQP Bridge", + "description": "A bridge for interacting with an AMQP 1.0 broker or router." + } + ] + }, + { + "code": "integration", + "category": "Integration", + "items": [ + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-mail-client", + "name": "Mail Client", + "description": "Vert.x provides a simple SMTP mail client so you can send emails from your applications." + }, + { + "groupId": "io.vertx", + "artifactId": "vertx-jca", + "name": "JCA Adaptor", + "description": "Vert.x provides a Java Connector Architecture (JCA) adaptor which allows it to interoperate with any JavaEE application server." + }, + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-kafka-client", + "name": "Kafka Client", + "description": "A client to interact with Apache Kafka." + }, + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-consul-client", + "name": "Consul Client", + "description": "A client to interact with Consul." + } + ] + }, + { + "code": "eventbus", + "category": "Event Bus Bridge", + "description": "Vert.x offers various bridges to extend the Event Bus beyond the JVM", + "items": [ + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-tcp-eventbus-bridge", + "name": "TCP Eventbus Bridge", + "description": "An eventbus bridge that lets you interact with Vert.x from any application thanks to a TCP socket." + }, + { + "groupId": "io.vertx", + "artifactId": "vertx-camel-bridge", + "name": "Camel Bridge", + "description": "An eventbus bridge that lets you interact with Apache Camel endpoints and routes" + } + ] + }, + { + "code": "monitoring", + "category": "Monitoring", + "description": "Vert.x offers various component to keep your Vert.x application on track when running in production", + "items": [ + { + "groupId": "io.vertx", + "artifactId": "vertx-dropwizard-metrics", + "name": "Metrics using Dropwizard", + "description": "This component captures metrics from Vert.x core components and exposes them using Dropwizard." + }, + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-micrometer-metrics", + "name": "Metrics using Micrometer", + "description": "This component captures metrics from Vert.x core components and exposes them using Micrometer." + }, + { + "groupId": "io.vertx", + "artifactId": "vertx-health-check", + "name": "Vert.x Health Check", + "description": "This component provides a simple way to expose health checks." + }, + { + "groupId": "io.vertx", + "artifactId": "vertx-zipkin", + "name": "Tracing using Zipkin", + "description": "Distributed tracing with Zipkin." + }, + { + "groupId": "io.vertx", + "artifactId": "vertx-opentracing", + "name": "Tracing using OpenTracing", + "description": "Distributed tracing with OpenTracing." + }, + { + "groupId": "io.vertx", + "artifactId": "vertx-opentelemetry", + "name": "Tracing using OpenTelemetry", + "description": "Distributed tracing with OpenTelemetry." + } + ] + }, + { + "code": "testing", + "category": "Testing", + "description": "Vert.x-Unit is an unit testing tool-kit especially design to work well with asynchronous code.", + "items": [ + { + "groupId": "io.vertx", + "name": "Vert.x Unit", + "artifactId": "vertx-unit" + }, + { + "groupId": "io.smallrye.reactive", + "name": "Vert.x JUnit5", + "artifactId": "smallrye-mutiny-vertx-junit5" + } + ] + }, + { + "code": "cluster", + "category": "Clustering", + "description": "Vert.x supports clustering and HA out of the box. Cluster group management is implemented in cluster managers which are pluggable.", + "items": [ + { + "groupId": "io.vertx", + "name": "Hazelcast Cluster Manager", + "artifactId": "vertx-hazelcast", + "description": "Cluster manager implementation that uses Hazelcast." + }, + { + "groupId": "io.vertx", + "name": "Infinispan Cluster Manager", + "artifactId": "vertx-infinispan", + "description": "Cluster manager implementation that uses Infinispan." + }, + { + "groupId": "io.vertx", + "name": "Apache Ignite Cluster Manager", + "artifactId": "vertx-ignite", + "description": "Cluster manager implementation that uses Apache Ignite." + }, + { + "groupId": "io.vertx", + "name": "Apache Zookeper Cluster Manager", + "artifactId": "vertx-zookeeper", + "description": "Cluster manager implementation that uses Apache Zookeeper." + } + ] + }, + { + "code": "services", + "category": "Services", + "description": "Vert.x services are a simple and effective way to encapsulate reusable functionality for use elsewhere. Services are deployed using a service identifier which decouples the user from details of the implementation.", + "items": [ + { + "groupId": "io.vertx", + "name": "Service Proxies", + "artifactId": "vertx-service-proxy", + "description": "Proxies allow remote event bus services to be called as if they were local." + }, + { + "groupId": "io.vertx", + "name": "SockJS Service Proxies", + "artifactId": "vertx-sockjs-service-proxy", + "description": "Allow event bus services to be called from JavaScript (browser or Node.js)." + }, + { + "groupId": "io.vertx", + "name": "gRPC", + "artifactId": "vertx-grpc", + "description": "Implement gRPC Clients and Servers for Vert.x." + }, + { + "groupId": "io.vertx", + "name": "Service Factories", + "artifactId": "vertx-service-factory", + "description": "How to package and deploy Vert.x independent services." + }, + { + "groupId": "io.vertx", + "name": "Maven Service Factory", + "artifactId": "vertx-maven-service-factory", + "description": "This lets you dynamically install and deploy services from Maven at run-time." + }, + { + "groupId": "io.vertx", + "name": "HTTP Service Factory", + "artifactId": "vertx-http-service-factory", + "description": "This lets you dynamically install and deploy services from an HTTP server (for example Bintray at run-time." + } + ] + }, + { + "code": "standards", + "category": "Standards", + "items": [ + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-json-schema", + "name": "JSON Schema", + "description": "An extensible implementation of the Json Schema specification to validate every JSON data structure, asynchronously." + } + ] + }, + { + "code": "devops", + "category": "Devops", + "items": [ + { + "groupId": "io.smallrye.reactive", + "artifactId": "smallrye-mutiny-vertx-shell", + "name": "Shell", + "description": "This component lets you interact with your Vert.x application using a CLI interface." + } + ] + } ] } diff --git a/src/main/resources/templates/build.gradle.kts.ftl b/src/main/resources/templates/build.gradle.kts.ftl index a5549f20..4c6f846d 100644 --- a/src/main/resources/templates/build.gradle.kts.ftl +++ b/src/main/resources/templates/build.gradle.kts.ftl @@ -31,7 +31,7 @@ repositories { val vertxVersion = "${vertxVersion}" <#if flavor == "mutiny"> -val mutinyVersion = "2.6.0" +val mutinyVersion = "2.7.0" val junitJupiterVersion = "5.7.0" @@ -49,14 +49,16 @@ application { dependencies { implementation(platform("io.vertx:vertx-stack-depchain:$vertxVersion")) -<#if !vertxDependencies?has_content> - implementation("${groupId}:${artifactIdPrefix}vertx-core") +<#if flavor == "vertx" && !vertxDependencies?has_content> + implementation("io.vertx:vertx-core") +<#elseif flavor == "mutiny" && !vertxDependencies?has_content> + implementation("io.smallrye.reactive:smallrye-mutiny-vertx-core:$mutinyVersion") <#list vertxDependencies as dependency> <#if flavor == "mutiny"> - implementation("${groupId}:${dependency}:$mutinyVersion") + implementation("${dependency.groupId}:${dependency.artifactId}:$mutinyVersion") <#else> - implementation("${groupId}:${dependency}") + implementation("${dependency.groupId}:${dependency.artifactId}") <#if language == "kotlin"> diff --git a/src/main/resources/templates/pom.xml.ftl b/src/main/resources/templates/pom.xml.ftl index 5b111e19..aa7a144e 100644 --- a/src/main/resources/templates/pom.xml.ftl +++ b/src/main/resources/templates/pom.xml.ftl @@ -31,7 +31,7 @@ 5.7.0 <#if flavor == "mutiny"> - 2.6.0 + 2.7.0 ${packageName}.MainVerticle @@ -53,23 +53,29 @@ -<#if !vertxDependencies?has_content> +<#if flavor == "vertx" && !vertxDependencies?has_content> - ${groupId} - ${artifactIdPrefix}vertx-core + io.vertx + vertx-core + +<#elseif flavor == "mutiny" && !vertxDependencies?has_content> + + io.smallrye.reactive + smallrye-mutiny-vertx-core + <#noparse>${mutiny.version} <#list vertxDependencies as dependency> <#if flavor == "mutiny"> - ${groupId} - ${dependency} + ${dependency.groupId} + ${dependency.artifactId} <#noparse>${mutiny.version} <#else> - ${groupId} - ${dependency} + ${dependency.groupId} + ${dependency.artifactId} @@ -84,7 +90,7 @@ <#list languageDependencies as dependency> - ${groupId} + io.vertx ${dependency} diff --git a/src/test/java/io/vertx/starter/MetadataHandlerTest.java b/src/test/java/io/vertx/starter/MetadataHandlerTest.java index a86e296e..9345dcb7 100644 --- a/src/test/java/io/vertx/starter/MetadataHandlerTest.java +++ b/src/test/java/io/vertx/starter/MetadataHandlerTest.java @@ -46,10 +46,11 @@ public void shouldReturnStarterMetadata(Vertx vertx, VertxTestContext testContex JsonObject defaults = starterData.getJsonObject("defaults"); JsonArray versions = starterData.getJsonArray("versions"); - JsonArray stack = starterData.getJsonArray("stack"); + JsonArray vertxStack = starterData.getJsonArray("vertxStack"); + JsonArray mutinyStack = starterData.getJsonArray("mutinyStack"); Router router = Router.router(vertx); - router.route().handler(new MetadataHandler(defaults, versions, stack)); + router.route().handler(new MetadataHandler(defaults, versions, vertxStack, mutinyStack)); vertx.createHttpServer(new HttpServerOptions().setPort(0)) .requestHandler(router) @@ -64,12 +65,13 @@ public void shouldReturnStarterMetadata(Vertx vertx, VertxTestContext testContex JsonObject metadata = response.bodyAsJsonObject(); assertThat(metadata.getJsonObject("defaults")).isEqualTo(defaults); assertThat(metadata.getJsonArray("versions")).isEqualTo(versions); - assertThat(metadata.getJsonArray("stack")).isEqualTo(stack); + assertThat(metadata.getJsonArray("stack")).isEqualTo(vertxStack); assertThat(metadata.getJsonArray("buildTools")).contains("maven", "gradle"); assertThat(metadata.getJsonArray("languages")).contains("java", "kotlin"); assertThat(metadata.getJsonArray("jdkVersions")).contains("1.8", "11", "16"); assertThat(metadata.getJsonArray("flavors")).contains("vert.x", "mutiny"); - assertThat(metadata.getJsonArray("vertxDependencies")).isEqualTo(stack); + assertThat(metadata.getJsonArray("vertxDependencies")).isEqualTo(vertxStack); + assertThat(metadata.getJsonArray("mutinyDependencies")).isEqualTo(mutinyStack); assertThat(metadata.getJsonArray("vertxVersions")).isEqualTo(versions.stream() .map(JsonObject.class::cast) .map(obj -> obj.getString("number")) diff --git a/src/test/java/io/vertx/starter/ValidationHandlerTest.java b/src/test/java/io/vertx/starter/ValidationHandlerTest.java index 895dd626..cc91c6c0 100644 --- a/src/test/java/io/vertx/starter/ValidationHandlerTest.java +++ b/src/test/java/io/vertx/starter/ValidationHandlerTest.java @@ -31,6 +31,7 @@ import io.vertx.ext.web.client.WebClientOptions; import io.vertx.junit5.VertxExtension; import io.vertx.junit5.VertxTestContext; +import io.vertx.starter.model.Dependency; import io.vertx.starter.model.VertxProject; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -38,6 +39,7 @@ import java.io.IOException; import java.util.Collections; +import java.util.Set; import static io.vertx.starter.config.ProjectConstants.*; import static io.vertx.starter.model.ArchiveFormat.ZIP; @@ -51,7 +53,8 @@ class ValidationHandlerTest { private JsonObject defaults; private JsonArray versions; - private JsonArray stack; + private JsonArray vertxStack; + private JsonArray mutinyStack; private ValidationHandler validator; private MultiMap params; @@ -60,8 +63,9 @@ void setUp() throws IOException { JsonObject starterData = Util.loadStarterData(); defaults = starterData.getJsonObject("defaults"); versions = starterData.getJsonArray("versions"); - stack = starterData.getJsonArray("stack"); - validator = new ValidationHandler(defaults, versions, stack); + vertxStack = starterData.getJsonArray("vertxStack"); + mutinyStack = starterData.getJsonArray("mutinyStack"); + validator = new ValidationHandler(defaults, versions, vertxStack, mutinyStack); params = MultiMap.caseInsensitiveMultiMap(); } @@ -102,8 +106,9 @@ void testUnknownDependency(Vertx vertx, VertxTestContext testContext) { @Test void testDependencyIncluded(Vertx vertx, VertxTestContext testContext) { - validator = new ValidationHandler(defaults, versions, stack); - VertxProject expected = defaults.mapTo(VertxProject.class).setVertxDependencies(Collections.singleton("vertx-web")); + validator = new ValidationHandler(defaults, versions, vertxStack, mutinyStack); + Set dependencies = Collections.singleton(new Dependency().setGroupId("io.vertx").setArtifactId("vertx-web")); + VertxProject expected = defaults.mapTo(VertxProject.class).setVertxDependencies(dependencies); expectSuccess(vertx, testContext, validator, params.add(VERTX_DEPENDENCIES, "vertx-web"), ZIP.getFileExtension(), expected); } @@ -112,12 +117,12 @@ void testDependencyExcluded(Vertx vertx, VertxTestContext testContext) { defaults.put("vertxVersion", "3.6.3"); versions = new JsonArray() .add(new JsonObject().put("number", "3.6.3").put("exclusions", new JsonArray().add("vertx-web-graphql"))); - stack = new JsonArray() + vertxStack = new JsonArray() .add(new JsonObject() .put("category", "Web") .put("items", new JsonArray().add(new JsonObject().put("artifactId", "vertx-web-graphql"))) ); - validator = new ValidationHandler(defaults, versions, stack); + validator = new ValidationHandler(defaults, versions, vertxStack, mutinyStack); expectFailure(vertx, testContext, validator, params.add(VERTX_DEPENDENCIES, "vertx-web-graphql"), ZIP.getFileExtension(), VERTX_DEPENDENCIES); } diff --git a/src/test/java/io/vertx/starter/service/GeneratorTest.java b/src/test/java/io/vertx/starter/service/GeneratorTest.java index 3d50ab74..ec0a239a 100644 --- a/src/test/java/io/vertx/starter/service/GeneratorTest.java +++ b/src/test/java/io/vertx/starter/service/GeneratorTest.java @@ -138,13 +138,16 @@ static Stream testProjectsJdk8() throws IOException { .filter(version -> !version.endsWith("-SNAPSHOT")) .collect(toList()); - List> testDeps = Arrays.asList(Collections.singleton("vertx-unit"), Collections.singleton("vertx-junit5")); + List> testDeps = Arrays.asList( + Collections.singleton(new Dependency().setArtifactId("vertx-unit")), + Collections.singleton(new Dependency().setArtifactId("vertx-junit5")) + ); Stream.Builder builder = Stream.builder(); for (BuildTool buildTool : BuildTool.values()) { for (Language language : Language.values()) { for (String version : versions) { - for (Set vertxDependencies : testDeps) { + for (Set vertxDependencies : testDeps) { VertxProject vertxProject = defaultProject() .setBuildTool(buildTool) .setLanguage(language) From 309f536a8e82a1d3c00d8cde132d3fea0cb5188a Mon Sep 17 00:00:00 2001 From: Selim Dincer Date: Sun, 20 Jun 2021 16:38:37 +0200 Subject: [PATCH 03/26] fix wrong flavor name in templates Signed-off-by: Selim Dincer --- src/main/resources/templates/build.gradle.kts.ftl | 2 +- src/main/resources/templates/pom.xml.ftl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/templates/build.gradle.kts.ftl b/src/main/resources/templates/build.gradle.kts.ftl index 4c6f846d..080420b3 100644 --- a/src/main/resources/templates/build.gradle.kts.ftl +++ b/src/main/resources/templates/build.gradle.kts.ftl @@ -49,7 +49,7 @@ application { dependencies { implementation(platform("io.vertx:vertx-stack-depchain:$vertxVersion")) -<#if flavor == "vertx" && !vertxDependencies?has_content> +<#if flavor == "vert.x" && !vertxDependencies?has_content> implementation("io.vertx:vertx-core") <#elseif flavor == "mutiny" && !vertxDependencies?has_content> implementation("io.smallrye.reactive:smallrye-mutiny-vertx-core:$mutinyVersion") diff --git a/src/main/resources/templates/pom.xml.ftl b/src/main/resources/templates/pom.xml.ftl index aa7a144e..a803bbbb 100644 --- a/src/main/resources/templates/pom.xml.ftl +++ b/src/main/resources/templates/pom.xml.ftl @@ -53,7 +53,7 @@ -<#if flavor == "vertx" && !vertxDependencies?has_content> +<#if flavor == "vert.x" && !vertxDependencies?has_content> io.vertx vertx-core From 071c09fabe9e81b4d6bc6d70db8b3a2677da44da Mon Sep 17 00:00:00 2001 From: Selim Dincer Date: Sun, 20 Jun 2021 16:49:26 +0200 Subject: [PATCH 04/26] remove obsolete artifact id prefix Signed-off-by: Selim Dincer --- .../java/io/vertx/starter/model/ProjectFlavor.java | 12 +++--------- .../io/vertx/starter/service/GeneratorService.java | 1 - 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/main/java/io/vertx/starter/model/ProjectFlavor.java b/src/main/java/io/vertx/starter/model/ProjectFlavor.java index 1db93378..9efa33ce 100644 --- a/src/main/java/io/vertx/starter/model/ProjectFlavor.java +++ b/src/main/java/io/vertx/starter/model/ProjectFlavor.java @@ -9,18 +9,16 @@ public enum ProjectFlavor { @JsonProperty(VERTX_FLAVOR) - VERTX(VERTX_FLAVOR, "io.vertx", ""), + VERTX(VERTX_FLAVOR, "io.vertx"), @JsonProperty(MUTINY_FLAVOR) - MUTINY(MUTINY_FLAVOR, "io.smallrye.reactive", "smallrye-mutiny-"); + MUTINY(MUTINY_FLAVOR, "io.smallrye.reactive"); private final String id; private final String groupId; - private final String artifactIdPrefix; - ProjectFlavor(String id, String groupId, String artifactIdPrefix) { + ProjectFlavor(String id, String groupId) { this.id = id; this.groupId = groupId; - this.artifactIdPrefix = artifactIdPrefix; } public String getId() { @@ -31,10 +29,6 @@ public String getGroupId() { return groupId; } - public String getArtifactIdPrefix() { - return artifactIdPrefix; - } - public static ProjectFlavor fromId(String id) { switch (id.toLowerCase(Locale.ROOT)) { case MUTINY_FLAVOR: diff --git a/src/main/java/io/vertx/starter/service/GeneratorService.java b/src/main/java/io/vertx/starter/service/GeneratorService.java index f7ad518f..e5c8aa47 100644 --- a/src/main/java/io/vertx/starter/service/GeneratorService.java +++ b/src/main/java/io/vertx/starter/service/GeneratorService.java @@ -135,7 +135,6 @@ private void createProject(VertxProject project, TempDir tempDir) throws IOExcep ctx.put("vertxDependencies", vertxDependencies); ctx.put("flavor", project.getFlavor().getId()); ctx.put("groupId", project.getFlavor().getGroupId()); - ctx.put("artifactIdPrefix", project.getFlavor().getArtifactIdPrefix()); String packageName = packageName(project); ctx.put("packageName", packageName); ctx.put("jdkVersion", project.getJdkVersion().getValue()); From 75b2527b95f71b2c5f7889d3e1a9b1661e829f12 Mon Sep 17 00:00:00 2001 From: Selim Dincer Date: Sun, 20 Jun 2021 16:52:27 +0200 Subject: [PATCH 05/26] add flavor option to README.md Signed-off-by: Selim Dincer --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e98b13bd..ba308819 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ You can provide the following query parameters to customize the project - `vertxDependencies`: a comma separated list of artifactIds of the vert.x modules - `packageName`: code package name, derived from `groupId` and `artifactId` by default - `jdkVersion`: which version of the JDK to use, defaults to `1.8` +- `flavor`: `vert.x` (default) or `mutiny` Full example: From 4e123d50ff9b4fc0b76617ac112c6a82e450068a Mon Sep 17 00:00:00 2001 From: Selim Dincer Date: Sun, 20 Jun 2021 17:05:46 +0200 Subject: [PATCH 06/26] fix bug where mutiny dependencies were not checked Signed-off-by: Selim Dincer --- src/main/java/io/vertx/starter/ValidationHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/vertx/starter/ValidationHandler.java b/src/main/java/io/vertx/starter/ValidationHandler.java index 80db155d..b8bd5704 100644 --- a/src/main/java/io/vertx/starter/ValidationHandler.java +++ b/src/main/java/io/vertx/starter/ValidationHandler.java @@ -131,7 +131,7 @@ public void handle(RoutingContext rc) { throw new IllegalArgumentException("There's no stack for flavor " + vertxProject.getFlavor()); } - if (vertxProject.getFlavor() == ProjectFlavor.VERTX && !stackDependencies.containsAll(vertxDependencies) || + if (!stackDependencies.containsAll(vertxDependencies) || !Collections.disjoint(exclusions.get(vertxProject.getVertxVersion()), vertxDependencies)) { fail(rc, VERTX_DEPENDENCIES, deps); return; From 2cd1c19996acd7a5aee3e53e090f92a7cec94356 Mon Sep 17 00:00:00 2001 From: Selim Dincer Date: Sun, 20 Jun 2021 17:06:02 +0200 Subject: [PATCH 07/26] remove "default" text from flavor in README.md Signed-off-by: Selim Dincer --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ba308819..eae3112e 100644 --- a/README.md +++ b/README.md @@ -33,13 +33,13 @@ You can provide the following query parameters to customize the project - `vertxDependencies`: a comma separated list of artifactIds of the vert.x modules - `packageName`: code package name, derived from `groupId` and `artifactId` by default - `jdkVersion`: which version of the JDK to use, defaults to `1.8` -- `flavor`: `vert.x` (default) or `mutiny` +- `flavor`: `vert.x` or `mutiny` Full example: ``` curl -X GET \ - 'http://start.vertx.io/starter.zip?artifactId=starter&buildTool=maven&groupId=io.vertx&language=java&vertxDependencies=&vertxVersion=4.1.0' \ + 'http://start.vertx.io/starter.zip?artifactId=starter&buildTool=maven&groupId=io.vertx&language=java&vertxDependencies=&vertxVersion=4.1.0&flavor=vert.x' \ -o starter.zip ``` @@ -52,6 +52,7 @@ artitfactId==starter \ language==java \ buildTool==maven \ vertxVersion==4.1.0 \ +flavor==vert.x \ vertxDependencies==vertx-web,vertx-web-client \ -o starter.zip ``` From 34c507db924a409aaa4b7e1361b365c301e12cba Mon Sep 17 00:00:00 2001 From: Selim Dincer Date: Sun, 20 Jun 2021 23:46:19 +0200 Subject: [PATCH 08/26] fix bug with mixed mutiny & vertx deps Signed-off-by: Selim Dincer --- .../java/io/vertx/starter/ValidationHandler.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/java/io/vertx/starter/ValidationHandler.java b/src/main/java/io/vertx/starter/ValidationHandler.java index b8bd5704..74d5b1d9 100644 --- a/src/main/java/io/vertx/starter/ValidationHandler.java +++ b/src/main/java/io/vertx/starter/ValidationHandler.java @@ -122,16 +122,21 @@ public void handle(RoutingContext rc) { .map(String::toLowerCase) .collect(toSet()); - Set stackDependencies; + boolean areAllDependenciesSatisfiable; if (vertxProject.getFlavor() == ProjectFlavor.VERTX) { - stackDependencies = vertxStackDependencies.keySet(); + areAllDependenciesSatisfiable = vertxStackDependencies.keySet() + .containsAll(vertxDependencies); } else if (vertxProject.getFlavor() == ProjectFlavor.MUTINY) { - stackDependencies = mutinyStackDependencies.keySet(); + areAllDependenciesSatisfiable = vertxDependencies.stream() + .allMatch(dependency -> + mutinyStackDependencies.keySet().stream() + .anyMatch(mutinyDependency -> mutinyDependency.endsWith(dependency)) + ); } else { throw new IllegalArgumentException("There's no stack for flavor " + vertxProject.getFlavor()); } - if (!stackDependencies.containsAll(vertxDependencies) || + if (!areAllDependenciesSatisfiable || !Collections.disjoint(exclusions.get(vertxProject.getVertxVersion()), vertxDependencies)) { fail(rc, VERTX_DEPENDENCIES, deps); return; From 973054717ae582b353563b67cdc31e8d36026545 Mon Sep 17 00:00:00 2001 From: Selim Dincer Date: Mon, 21 Jun 2021 00:05:36 +0200 Subject: [PATCH 09/26] fix version bug with mixed mutiny & vertx deps Signed-off-by: Selim Dincer --- src/main/java/io/vertx/starter/model/Dependency.java | 4 ++++ src/main/resources/templates/build.gradle.kts.ftl | 2 +- src/main/resources/templates/pom.xml.ftl | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/vertx/starter/model/Dependency.java b/src/main/java/io/vertx/starter/model/Dependency.java index 21c006d3..00735dff 100644 --- a/src/main/java/io/vertx/starter/model/Dependency.java +++ b/src/main/java/io/vertx/starter/model/Dependency.java @@ -24,6 +24,10 @@ public Dependency setArtifactId(String artifactId) { return this; } + public boolean isVertxDependency() { + return ProjectFlavor.VERTX.getGroupId().equals(groupId); + } + @Override public boolean equals(Object o) { if (this == o) return true; diff --git a/src/main/resources/templates/build.gradle.kts.ftl b/src/main/resources/templates/build.gradle.kts.ftl index 080420b3..604fb7d7 100644 --- a/src/main/resources/templates/build.gradle.kts.ftl +++ b/src/main/resources/templates/build.gradle.kts.ftl @@ -55,7 +55,7 @@ dependencies { implementation("io.smallrye.reactive:smallrye-mutiny-vertx-core:$mutinyVersion") <#list vertxDependencies as dependency> - <#if flavor == "mutiny"> + <#if flavor == "mutiny" && !dependency.vertxDependency> implementation("${dependency.groupId}:${dependency.artifactId}:$mutinyVersion") <#else> implementation("${dependency.groupId}:${dependency.artifactId}") diff --git a/src/main/resources/templates/pom.xml.ftl b/src/main/resources/templates/pom.xml.ftl index a803bbbb..fd1edb2e 100644 --- a/src/main/resources/templates/pom.xml.ftl +++ b/src/main/resources/templates/pom.xml.ftl @@ -66,7 +66,7 @@ <#list vertxDependencies as dependency> - <#if flavor == "mutiny"> + <#if flavor == "mutiny" && !dependency.vertxDependency> ${dependency.groupId} ${dependency.artifactId} From c86dfec47c776a3a1f940f7cf6eeb2cabc00f6eb Mon Sep 17 00:00:00 2001 From: Selim Dincer Date: Mon, 21 Jun 2021 00:21:37 +0200 Subject: [PATCH 10/26] ignore isVertxDependency in jackson Signed-off-by: Selim Dincer --- src/main/java/io/vertx/starter/model/Dependency.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/io/vertx/starter/model/Dependency.java b/src/main/java/io/vertx/starter/model/Dependency.java index 00735dff..5a1e3c81 100644 --- a/src/main/java/io/vertx/starter/model/Dependency.java +++ b/src/main/java/io/vertx/starter/model/Dependency.java @@ -1,5 +1,7 @@ package io.vertx.starter.model; +import com.fasterxml.jackson.annotation.JsonIgnore; + import java.util.Objects; public class Dependency { @@ -24,6 +26,7 @@ public Dependency setArtifactId(String artifactId) { return this; } + @JsonIgnore public boolean isVertxDependency() { return ProjectFlavor.VERTX.getGroupId().equals(groupId); } From b0b31e61856c2b7f1c02ee7566b5ae7d1314be20 Mon Sep 17 00:00:00 2001 From: Selim Dincer Date: Sat, 26 Jun 2021 09:01:51 +0200 Subject: [PATCH 11/26] fix bug where groupId ends up wrong Signed-off-by: Selim Dincer --- src/main/java/io/vertx/starter/service/GeneratorService.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/io/vertx/starter/service/GeneratorService.java b/src/main/java/io/vertx/starter/service/GeneratorService.java index e5c8aa47..6fdad7e2 100644 --- a/src/main/java/io/vertx/starter/service/GeneratorService.java +++ b/src/main/java/io/vertx/starter/service/GeneratorService.java @@ -134,7 +134,6 @@ private void createProject(VertxProject project, TempDir tempDir) throws IOExcep ctx.put("languageDependencies", language.getLanguageDependencies()); ctx.put("vertxDependencies", vertxDependencies); ctx.put("flavor", project.getFlavor().getId()); - ctx.put("groupId", project.getFlavor().getGroupId()); String packageName = packageName(project); ctx.put("packageName", packageName); ctx.put("jdkVersion", project.getJdkVersion().getValue()); From 3ca065d86bd005445e0dc4c86ddcab29c65f1087 Mon Sep 17 00:00:00 2001 From: Selim Dincer Date: Sat, 26 Jun 2021 09:05:07 +0200 Subject: [PATCH 12/26] make sure flavor deps are handled correctly Signed-off-by: Selim Dincer --- src/main/java/io/vertx/starter/ValidationHandler.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/vertx/starter/ValidationHandler.java b/src/main/java/io/vertx/starter/ValidationHandler.java index 74d5b1d9..4e0884d9 100644 --- a/src/main/java/io/vertx/starter/ValidationHandler.java +++ b/src/main/java/io/vertx/starter/ValidationHandler.java @@ -147,7 +147,7 @@ public void handle(RoutingContext rc) { return; } - Set flavoredDependencies = new HashSet<>(vertxDependencies.size()); + Set flavoredDependencies; if (vertxProject.getFlavor() == ProjectFlavor.VERTX) { flavoredDependencies = vertxDependencies.stream() .map(vertxStackDependencies::get) @@ -161,6 +161,8 @@ public void handle(RoutingContext rc) { .map(Optional::get) .map(mutinyStackDependencies::get) .collect(toSet()); + } else { + throw new IllegalArgumentException("Unknown project flavor " + vertxProject.getFlavor()); } vertxProject.setVertxDependencies(flavoredDependencies); From b886b1d2d562994849b88abfb63e8a4d9d5f085d Mon Sep 17 00:00:00 2001 From: Selim Dincer Date: Mon, 5 Jul 2021 19:40:43 +0200 Subject: [PATCH 13/26] use Vert.x API instead of Flavor for website Signed-off-by: Selim Dincer --- src/main/resources/webroot/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/webroot/index.html b/src/main/resources/webroot/index.html index 6683acaa..9bd1b31b 100644 --- a/src/main/resources/webroot/index.html +++ b/src/main/resources/webroot/index.html @@ -109,7 +109,7 @@

Create a new Vert.x application

- +