diff --git a/bom/application/pom.xml b/bom/application/pom.xml index ee2ece8a083ab..7ada2a259ee04 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -158,7 +158,7 @@ 3.2.0 4.2.1 3.0.6.Final - 10.15.0 + 10.15.2 3.0.3 4.27.0 diff --git a/core/deployment/src/main/java/io/quarkus/runner/bootstrap/AugmentActionImpl.java b/core/deployment/src/main/java/io/quarkus/runner/bootstrap/AugmentActionImpl.java index ebe88aa820873..2a3daf76470e6 100644 --- a/core/deployment/src/main/java/io/quarkus/runner/bootstrap/AugmentActionImpl.java +++ b/core/deployment/src/main/java/io/quarkus/runner/bootstrap/AugmentActionImpl.java @@ -1,7 +1,6 @@ package io.quarkus.runner.bootstrap; import java.io.File; -import java.io.FileOutputStream; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.nio.charset.StandardCharsets; @@ -32,6 +31,7 @@ import io.quarkus.bootstrap.app.QuarkusBootstrap; import io.quarkus.bootstrap.classloading.ClassLoaderEventListener; import io.quarkus.bootstrap.classloading.QuarkusClassLoader; +import io.quarkus.bootstrap.util.PropertyUtils; import io.quarkus.builder.BuildChainBuilder; import io.quarkus.builder.BuildResult; import io.quarkus.builder.item.BuildItem; @@ -235,8 +235,8 @@ private void writeArtifactResultMetadataFile(BuildSystemTargetBuildItem outputTa properties.put("metadata." + entry.getKey(), entry.getValue()); } } - try (FileOutputStream fos = new FileOutputStream(quarkusArtifactMetadataPath.toFile())) { - properties.store(fos, "Generated by Quarkus - Do not edit manually"); + try { + PropertyUtils.store(properties, quarkusArtifactMetadataPath, "Generated by Quarkus - Do not edit manually"); } catch (IOException e) { log.debug("Unable to write artifact result metadata file", e); } diff --git a/devtools/cli/src/main/java/io/quarkus/cli/QuarkusCli.java b/devtools/cli/src/main/java/io/quarkus/cli/QuarkusCli.java index be09f9207e77a..0551ebb9abddd 100644 --- a/devtools/cli/src/main/java/io/quarkus/cli/QuarkusCli.java +++ b/devtools/cli/src/main/java/io/quarkus/cli/QuarkusCli.java @@ -185,6 +185,11 @@ public Optional checkMissingCommand(CommandLine root, String[] args) { return Optional.empty(); } catch (UnmatchedArgumentException e) { return Optional.of(args[0]); + } catch (Exception e) { + // For any other exceptions (e.g. MissingParameterException), we should just ignore. + // The problem is not that the command is missing but that the options might not be adequate. + // This will be handled by Picocli at a later step. + return Optional.empty(); } } diff --git a/docs/src/main/asciidoc/security-jwt-build.adoc b/docs/src/main/asciidoc/security-jwt-build.adoc index 34a51fec4e9cb..40273dc43543c 100644 --- a/docs/src/main/asciidoc/security-jwt-build.adoc +++ b/docs/src/main/asciidoc/security-jwt-build.adoc @@ -241,8 +241,8 @@ As mentioned above, `iat` (issued at), `exp` (expires at), `jti` (token identifi [source,properties] ---- -smallrye.jwt.sign.key=privateKey.pem -smallrye.jwt.encrypt.key=publicKey.pem +smallrye.jwt.sign.key.location=privateKey.pem +smallrye.jwt.encrypt.key.location=publicKey.pem ---- You can also use MicroProfile `ConfigSource` to fetch the keys from the external services such as link:{vault-guide}[HashiCorp Vault] or other secret managers and use `smallrye.jwt.sign.key` and `smallrye.jwt.encrypt.key` properties instead: diff --git a/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/util/PropertyUtils.java b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/util/PropertyUtils.java index 8751c22210ce4..c432f019cc028 100644 --- a/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/util/PropertyUtils.java +++ b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/util/PropertyUtils.java @@ -61,12 +61,13 @@ public static final boolean getBoolean(String name, boolean notFoundValue) { * {@link Properties#store(Writer, String)} format but skipping the timestamp and comments. * * @param properties properties to store + * @param leadingComment a leading comment, it will be prepended by an hash * @param file target file * @throws IOException in case of a failure */ - public static void store(Properties properties, Path file) throws IOException { + public static void store(Properties properties, Path file, String leadingComment) throws IOException { try (BufferedWriter writer = Files.newBufferedWriter(file)) { - store(properties, writer); + store(properties, writer, leadingComment); } } @@ -75,11 +76,19 @@ public static void store(Properties properties, Path file) throws IOException { * {@link Properties#store(Writer, String)} format but skipping the timestamp and comments. * * @param properties properties to store + * @param leadingComment a leading comment, it will be prepended by an hash * @param writer target writer * @throws IOException in case of a failure */ - public static void store(Properties properties, Writer writer) throws IOException { + public static void store(Properties properties, Writer writer, String leadingComment) throws IOException { final List names = new ArrayList<>(properties.size()); + + if (leadingComment != null && !leadingComment.isBlank()) { + writer.write("# "); + writer.write(leadingComment); + writer.write(System.lineSeparator()); + } + for (var name : properties.keySet()) { names.add(name == null ? null : name.toString()); } @@ -97,16 +106,58 @@ public static void store(Properties properties, Writer writer) throws IOExceptio * @param file target file * @throws IOException in case of a failure */ - public static void store(Map properties, Path file) throws IOException { + public static void store(Map properties, Path file, String leadingComment) throws IOException { final List names = new ArrayList<>(properties.keySet()); Collections.sort(names); try (BufferedWriter writer = Files.newBufferedWriter(file)) { + if (leadingComment != null && !leadingComment.isBlank()) { + writer.write("# "); + writer.write(leadingComment); + writer.write(System.lineSeparator()); + } + for (String name : names) { store(writer, name, properties.get(name)); } } } + /** + * Stores properties into a file sorting the keys alphabetically and following + * {@link Properties#store(Writer, String)} format but skipping the timestamp and comments. + * + * @param properties properties to store + * @param file target file + * @throws IOException in case of a failure + */ + public static void store(Properties properties, Path file) throws IOException { + store(properties, file, null); + } + + /** + * Stores properties into a file sorting the keys alphabetically and following + * {@link Properties#store(Writer, String)} format but skipping the timestamp and comments. + * + * @param properties properties to store + * @param writer target writer + * @throws IOException in case of a failure + */ + public static void store(Properties properties, Writer writer) throws IOException { + store(properties, writer, null); + } + + /** + * Stores a map of strings into a file sorting the keys alphabetically and following + * {@link Properties#store(Writer, String)} format but skipping the timestamp and comments. + * + * @param properties properties to store + * @param file target file + * @throws IOException in case of a failure + */ + public static void store(Map properties, Path file) throws IOException { + store(properties, file, null); + } + /** * Writes a config option with its value to the target writer, * possibly applying some transformations, such as character escaping