From 04d91c5ff7d0ba346308e7c76abf541374a062f2 Mon Sep 17 00:00:00 2001 From: Clement Escoffier Date: Wed, 5 Oct 2022 09:33:03 +0200 Subject: [PATCH] Add a mojo parameter to allow quarkus:dev to specify the add-modules clause. This is required if your application uses any preview APIs, such as structured concurrency. --- .../src/main/java/io/quarkus/maven/DevMojo.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java index e9b1b274eb118..f2172937fda5d 100644 --- a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java +++ b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java @@ -221,6 +221,14 @@ public class DevMojo extends AbstractMojo { @Parameter(defaultValue = "${open-lang-package}") private boolean openJavaLang; + + /** + * Allows configuring the modules to add to the application. + * The listed modules will be added using: {@code --add-modules m1,m2...}. + */ + @Parameter(defaultValue = "${add-modules}") + private List modules; + /** * Whether the JVM launch, in debug mode, should be suspended. This parameter is only * relevant when the JVM is launched in {@link #debug debug mode}. This parameter supports the @@ -985,6 +993,12 @@ private QuarkusDevModeLauncher newLauncher() throws Exception { builder.jvmArgs("java.base/java.lang=ALL-UNNAMED"); } + if (modules != null && !modules.isEmpty()) { + String mods = String.join(",", this.modules); + builder.jvmArgs("--add-modules"); + builder.jvmArgs(mods); + } + builder.projectDir(project.getFile().getParentFile()); Properties projectProperties = project.getProperties();