From 5d887ffc1081cdf81f262f83f3af8f56c3d779cb Mon Sep 17 00:00:00 2001 From: Thibault Vallin Date: Tue, 26 Mar 2024 19:34:55 +0100 Subject: [PATCH] 3.x: Archetype - Backport several issues from 4.x to 3.x (#8564) * Fix Json code duplication Signed-off-by: tvallin * Fix archetypes module Signed-off-by: tvallin * Add opens WEB to module info for multipart Signed-off-by: tvallin * Kubernetes uses ClusterIP instead of NodePort Signed-off-by: tvallin * fix sql script for oracle database Signed-off-by: tvallin * Archetype generates .gitignore Signed-off-by: tvallin * update index.html to match backend endpoint Signed-off-by: tvallin --------- Signed-off-by: tvallin --- .../src/main/archetype/common/common.xml | 1 + .../src/main/archetype/common/extra.xml | 6 +-- .../common/files/.gitignore.mustache | 38 ++++++++++++++++ .../archetype/common/files/app.yaml.mustache | 9 ++-- .../src/main/java/module-info.java.mustache | 13 +++++- .../src/main/archetype/common/media.xml | 44 +++++++++++-------- .../main/archetype/common/observability.xml | 8 ++-- .../src/main/archetype/common/packaging.xml | 25 +++++------ .../src/main/archetype/common/security.xml | 4 +- .../main/archetype/mp/custom/custom-mp.xml | 3 +- .../src/main/archetype/mp/custom/database.xml | 18 +++++--- .../archetype/mp/database/database-mp.xml | 2 +- ...nit_script.sql => init_script.sql.default} | 0 .../resources/META-INF/init_script.sql.oracle | 25 +++++++++++ .../archetype/mp/quickstart/quickstart-mp.xml | 2 +- .../main/archetype/se/common/common-se.xml | 2 +- .../main/archetype/se/custom/custom-se.xml | 3 +- .../src/main/archetype/se/custom/database.xml | 6 ++- .../FileService.java.multipart.mustache | 14 +++--- .../FileStorage.java.multipart.mustache | 6 +-- .../files/src/main/resources/WEB/index.html | 42 ++++++++++++++++++ .../FileServiceTest.java.multipart.mustache | 4 +- 22 files changed, 204 insertions(+), 71 deletions(-) create mode 100644 archetypes/helidon/src/main/archetype/common/files/.gitignore.mustache rename archetypes/helidon/src/main/archetype/mp/database/files/src/main/resources/META-INF/{init_script.sql => init_script.sql.default} (100%) create mode 100644 archetypes/helidon/src/main/archetype/mp/database/files/src/main/resources/META-INF/init_script.sql.oracle create mode 100644 archetypes/helidon/src/main/archetype/se/custom/files/src/main/resources/WEB/index.html diff --git a/archetypes/helidon/src/main/archetype/common/common.xml b/archetypes/helidon/src/main/archetype/common/common.xml index c68513c077d..7f3fa8cb83c 100644 --- a/archetypes/helidon/src/main/archetype/common/common.xml +++ b/archetypes/helidon/src/main/archetype/common/common.xml @@ -42,6 +42,7 @@ .helidon.mustache README.md.mustache + .gitignore.mustache diff --git a/archetypes/helidon/src/main/archetype/common/extra.xml b/archetypes/helidon/src/main/archetype/common/extra.xml index 4305e0dce91..af7ccd34bb3 100644 --- a/archetypes/helidon/src/main/archetype/common/extra.xml +++ b/archetypes/helidon/src/main/archetype/common/extra.xml @@ -33,7 +33,7 @@ - + io.helidon.webclient @@ -67,7 +67,7 @@ helidon-webclient - + io.helidon.microprofile.faulttolerance io.helidon.common.reactive io.helidon.faulttolerance @@ -154,7 +154,7 @@ .addCrossOrigin(CrossOriginConfig.create()) .build();]]> - + io.helidon.microprofile.cors io.helidon.webserver.cors diff --git a/archetypes/helidon/src/main/archetype/common/files/.gitignore.mustache b/archetypes/helidon/src/main/archetype/common/files/.gitignore.mustache new file mode 100644 index 00000000000..2a9fe873a8d --- /dev/null +++ b/archetypes/helidon/src/main/archetype/common/files/.gitignore.mustache @@ -0,0 +1,38 @@ +# Compiled class file +*.class + +# Maven +target/ +.m2/ + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# IntelliJ Idea +.idea/ +*.iws +*.ipr +*.iml +*.releaseBackup +atlassian-ide-plugin.xml + +# Netbeans +nbactions.xml +nb-configuration.xml + +# Eclipse +.settings +.settings/ +.project +.classpath +.factorypath + +{{#gitignore}} +{{.}} +{{/gitignore}} diff --git a/archetypes/helidon/src/main/archetype/common/files/app.yaml.mustache b/archetypes/helidon/src/main/archetype/common/files/app.yaml.mustache index 9a51f58cd6b..4178b288e06 100644 --- a/archetypes/helidon/src/main/archetype/common/files/app.yaml.mustache +++ b/archetypes/helidon/src/main/archetype/common/files/app.yaml.mustache @@ -5,13 +5,14 @@ metadata: labels: app: {{artifactId}} spec: - type: NodePort + type: ClusterIP selector: app: {{artifactId}} ports: - - port: 8080 - targetPort: 8080 - name: http + - name: tcp + port: 8080 + protocol: TCP + targetPort: 8080 --- kind: Deployment apiVersion: apps/v1 diff --git a/archetypes/helidon/src/main/archetype/common/files/src/main/java/module-info.java.mustache b/archetypes/helidon/src/main/archetype/common/files/src/main/java/module-info.java.mustache index 90323eb4445..4e520db9fc8 100644 --- a/archetypes/helidon/src/main/archetype/common/files/src/main/java/module-info.java.mustache +++ b/archetypes/helidon/src/main/archetype/common/files/src/main/java/module-info.java.mustache @@ -1,6 +1,15 @@ module {{package}} { -{{#modules}} +{{#module-requires}} requires {{.}}; -{{/modules}} +{{/module-requires}} + + exports {{package}}; + +{{#module-opens}} + opens {{.}}; +{{/module-opens}} +{{#module-opens-package}} + opens {{package}}; +{{/module-opens-package}} } \ No newline at end of file diff --git a/archetypes/helidon/src/main/archetype/common/media.xml b/archetypes/helidon/src/main/archetype/common/media.xml index 6ae68576b29..3ec1ab32211 100644 --- a/archetypes/helidon/src/main/archetype/common/media.xml +++ b/archetypes/helidon/src/main/archetype/common/media.xml @@ -1,7 +1,7 @@