[MJLINK-64] add quoting on forking (#166)

diff --git a/src/it/projects/cli-options/add-options/verify.groovy b/src/it/projects/cli-options/add-options/verify.groovy
index 8bd9385..2281a99 100644
--- a/src/it/projects/cli-options/add-options/verify.groovy
+++ b/src/it/projects/cli-options/add-options/verify.groovy
@@ -24,12 +24,11 @@
 import org.codehaus.plexus.util.*
 
 String buildlog = new File( basedir, "build.log").text
-assert buildlog.contains( "--add-options" )
-assert buildlog.contains( "\"-Xmx128m --enable-preview -Dvar=value\"" )
+assert buildlog.contains( "--add-options, \"-Xmx128m --enable-preview -Dvar=value\"" )
+assert buildlog.contains( "addOptions = [-Xmx128m, --enable-preview, -Dvar=value]" )
 
 File target = new File( basedir, "target" )
 assert target.isDirectory()
 
 File artifact = new File( target, "maven-jlink-plugin-cli-options-add-options-101.0.zip" )
 assert artifact.isFile()
-
diff --git a/src/main/java/org/apache/maven/plugins/jlink/AbstractJLinkToolchainExecutor.java b/src/main/java/org/apache/maven/plugins/jlink/AbstractJLinkToolchainExecutor.java
index 086492c..15fd7db 100644
--- a/src/main/java/org/apache/maven/plugins/jlink/AbstractJLinkToolchainExecutor.java
+++ b/src/main/java/org/apache/maven/plugins/jlink/AbstractJLinkToolchainExecutor.java
@@ -102,7 +102,7 @@
 
     private Commandline createJLinkCommandLine(List<String> jlinkArgs) {
         Commandline cmd = new Commandline();
-        jlinkArgs.forEach(arg -> cmd.createArg().setValue(arg));
+        jlinkArgs.forEach(arg -> cmd.createArg().setValue("\"" + arg + "\""));
 
         return cmd;
     }
diff --git a/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java b/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java
index a5f203d..34487a3 100644
--- a/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java
+++ b/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java
@@ -577,7 +577,7 @@
         }
     }
 
-    private List<String> createJlinkArgs(Collection<String> pathsOfModules, Collection<String> modulesToAdd) {
+    protected List<String> createJlinkArgs(Collection<String> pathsOfModules, Collection<String> modulesToAdd) {
         List<String> jlinkArgs = new ArrayList<>();
 
         if (stripDebug) {
@@ -612,7 +612,7 @@
             jlinkArgs.add("--disable-plugin");
             jlinkArgs.add(disablePlugin);
         }
-        if (pathsOfModules != null) {
+        if (pathsOfModules != null && !pathsOfModules.isEmpty()) {
             // @formatter:off
             jlinkArgs.add("--module-path");
             jlinkArgs.add(getPlatformDependSeparateList(pathsOfModules).replace("\\", "\\\\"));
diff --git a/src/test/java/org/apache/maven/plugins/jlink/JLinkMojoTest.java b/src/test/java/org/apache/maven/plugins/jlink/JLinkMojoTest.java
new file mode 100644
index 0000000..77d670f
--- /dev/null
+++ b/src/test/java/org/apache/maven/plugins/jlink/JLinkMojoTest.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.plugins.jlink;
+
+import java.lang.reflect.Field;
+import java.util.List;
+
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class JLinkMojoTest {
+
+    @Test
+    void quote_every_argument() throws Exception {
+        // given
+        JLinkMojo mojo = new JLinkMojo();
+        Field stripDebug = mojo.getClass().getDeclaredField("stripDebug");
+        stripDebug.setAccessible(true);
+        stripDebug.set(mojo, Boolean.TRUE);
+
+        // when
+        List<String> jlinkArgs = mojo.createJlinkArgs(List.of(), List.of());
+
+        // then
+        assertThat(jlinkArgs).noneMatch(arg -> arg.trim().isBlank());
+    }
+}