From 6ac8d9b1231686f841c50c1b6b299675cc2790dd Mon Sep 17 00:00:00 2001 From: Tim Quinn Date: Mon, 24 Jan 2022 03:22:50 -0600 Subject: [PATCH] Change Helidon MP release in generated project from 1.x to 2.x (#11076) * Support Helidon MP server using Helidon 2.4.1 Signed-off-by: tim.quinn@oracle.com * Add unrelated changed sample file(s) after rebase * Updated generated samples file after rebasing again * Remove incorrectly 'git add'ed generated file --- .../languages/JavaJAXRSSpecServerCodegen.java | 3 +- .../spec/libraries/helidon/README.mustache | 4 +- .../helidon/logging.properties.mustache | 21 +- .../microprofile-config.properties.mustache | 9 +- .../spec/libraries/helidon/pom.mustache | 278 +++++++++++++----- 5 files changed, 221 insertions(+), 94 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java index 8b50933247a..23c82cc2edd 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java @@ -213,11 +213,12 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen { supportingFiles.add(new SupportingFile("ibm-web-ext.xml.mustache", "src/main/webapp/WEB-INF", "ibm-web-ext.xml") .doNotOverwrite()); } else if(HELIDON_LIBRARY.equals(library)) { + additionalProperties.computeIfAbsent("helidonVersion", key -> "2.4.1"); supportingFiles.add(new SupportingFile("logging.properties.mustache", "src/main/resources", "logging.properties") .doNotOverwrite()); supportingFiles.add(new SupportingFile("microprofile-config.properties.mustache", "src/main/resources/META-INF", "microprofile-config.properties") .doNotOverwrite()); - supportingFiles.add(new SupportingFile("beans.xml.mustache", "src/main/webapp/META-INF", "beans.xml") + supportingFiles.add(new SupportingFile("beans.xml.mustache", "src/main/resources/META-INF", "beans.xml") .doNotOverwrite()); } else if(KUMULUZEE_LIBRARY.equals(library)) { supportingFiles.add(new SupportingFile("config.yaml.mustache", "src/main/resources", "config.yaml")); diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/helidon/README.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/helidon/README.mustache index d7982e6e6a6..d2d0ddaa1e5 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/helidon/README.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/helidon/README.mustache @@ -16,7 +16,7 @@ The jar can be used in combination with an other project providing the implement {{/interfaceOnly}} {{^interfaceOnly}} -To build the server, run this maven command: +To build the server, run this maven command (with JDK 11+): ```bash mvn package @@ -25,7 +25,7 @@ mvn package To run the server, run this maven command: ```bash -mvn exec:java +java -jar target/{{artifactId}}.jar ``` You can then call your server endpoints under: diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/helidon/logging.properties.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/helidon/logging.properties.mustache index fea543d4c33..3e909fb7d90 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/helidon/logging.properties.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/helidon/logging.properties.mustache @@ -1,19 +1,20 @@ # Example Logging Configuration File # For more information see $JAVA_HOME/jre/lib/logging.properties -# Send messages to the console -handlers=java.util.logging.ConsoleHandler - -# Global default logging level. Can be overridden by specific handlers and loggers +## Send messages to the console +handlers=io.helidon.common.HelidonConsoleHandler +# +## HelidonConsoleHandler uses a SimpleFormatter subclass that replaces "!thread!" with the current thread +java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$s %3$s !thread!: %5$s%6$s%n +# +## Global logging level. Can be overridden by specific loggers .level=INFO -# Helidon Web Server has a custom log formatter that extends SimpleFormatter. -# It replaces "!thread!" with the current thread name -java.util.logging.ConsoleHandler.level=INFO -java.util.logging.ConsoleHandler.formatter=io.helidon.webserver.WebServerLogFormatter -java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$s %3$s !thread!: %5$s%6$s%n +# Quiet Weld +org.jboss.level=WARNING -#Component specific log levels +# +# Component specific log levels #io.helidon.webserver.level=INFO #io.helidon.config.level=INFO #io.helidon.security.level=INFO diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/helidon/microprofile-config.properties.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/helidon/microprofile-config.properties.mustache index 1780a159b0a..38988f20e5e 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/helidon/microprofile-config.properties.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/helidon/microprofile-config.properties.mustache @@ -1,6 +1,11 @@ +# Microprofile server properties + +# Application properties. This is the default greeting +app.greeting=Hello + # Microprofile server properties server.port=8080 server.host=0.0.0.0 -# Microprofile OpenAPI properties -mp.openapi.scan.disable=true \ No newline at end of file +# Enable the optional MicroProfile Metrics REST.request metrics +metrics.rest-request.enabled=true diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/helidon/pom.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/helidon/pom.mustache index e72b2b5d440..91c575960dc 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/helidon/pom.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/helidon/pom.mustache @@ -16,103 +16,223 @@ {{/parentOverridden}} - io.helidon.microprofile.server.Main - 1.2.0 + + {{helidonVersion}} + io.helidon.microprofile.cdi.Main + + 11 + ${maven.compiler.source} + true + UTF-8 + UTF-8 + + 3.8.1 + 3.0.0 + 2.7.5.1 1.6.0 + 3.0.0-M5 + 2.3.0 + 2.3.0 1.0.6 3.0.2 - 1.1.2 - 2.29 - 1.2.2 - 5.1.0 + 1.5.0.Final + 0.5.1 + 2.7 + 3.0.0-M5 - - - - org.jboss.jandex - jandex-maven-plugin - ${version.plugin.jandex} - - - make-index - - jandex - - - - - - org.apache.maven.plugins - maven-jar-plugin - ${version.plugin.jar} - - - - true - ${mainClass} - - - - - - org.apache.maven.plugins - maven-compiler-plugin - ${version.plugin.compiler} - - 1.8 - 1.8 - - -Xlint:unchecked - - - - - org.codehaus.mojo - exec-maven-plugin - ${version.plugin.exec} - - ${mainClass} - - - - + + + + io.helidon + helidon-dependencies + ${helidon.version} + pom + import + + + io.helidon.microprofile.bundles - helidon-microprofile-2.2 - ${version.lib.helidon} + helidon-microprofile - org.eclipse.microprofile.openapi - microprofile-openapi-api - ${version.lib.microprofile-openapi-api} - - - org.glassfish.jersey.media - jersey-media-json-binding - ${version.lib.jersey} - runtime - - - jakarta.activation - jakarta.activation-api - ${version.lib.activation-api} + org.jboss + jandex runtime + true org.junit.jupiter junit-jupiter-api - ${version.lib.junit} - test - - - org.junit.jupiter - junit-jupiter-engine - ${version.lib.junit} test + + + ${project.artifactId} + + + + org.apache.maven.plugins + maven-compiler-plugin + ${version.plugin.compiler} + + + org.apache.maven.plugins + maven-surefire-plugin + ${version.plugin.surefire} + + false + + ${project.build.outputDirectory}/logging.properties + + + + + org.apache.maven.plugins + maven-failsafe-plugin + ${version.plugin.failsafe} + + false + true + + + + org.apache.maven.plugins + maven-dependency-plugin + ${version.plugin.dependency} + + + org.apache.maven.plugins + maven-resources-plugin + ${version.plugin.resources} + + + org.apache.maven.plugins + maven-jar-plugin + ${version.plugin.jar} + + + + true + libs + ${mainClass} + false + + + + + + org.jboss.jandex + jandex-maven-plugin + ${version.plugin.jandex} + + + org.codehaus.mojo + exec-maven-plugin + ${version.plugin.exec} + + ${mainClass} + + + + io.helidon.build-tools + helidon-maven-plugin + ${version.plugin.helidon} + + + io.helidon.build-tools + helidon-cli-maven-plugin + ${version.plugin.helidon-cli} + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-libs + prepare-package + + copy-dependencies + + + ${project.build.directory}/libs + false + false + true + true + runtime + test + + + + + + org.jboss.jandex + jandex-maven-plugin + + + make-index + + jandex + + process-classes + + + + + + + + + native-image + + + + io.helidon.build-tools + helidon-maven-plugin + + + native-image + + native-image + + + + + + + + + io.helidon.integrations.graal + helidon-mp-graal-native-image-extension + + + + + jlink-image + + + + io.helidon.build-tools + helidon-maven-plugin + + + + jlink-image + + + + + + + +