You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2017/08/07 10:43:31 UTC

maven-surefire git commit: [SUREFIRE-1403] [Jigsaw] [Java 9] add "--add-modules ALL-SYSTEM" to forked CLI argument

Repository: maven-surefire
Updated Branches:
  refs/heads/SUREFIRE-1403 [created] 3726a003f


[SUREFIRE-1403] [Jigsaw] [Java 9] add "--add-modules ALL-SYSTEM" to forked CLI argument


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/3726a003
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/3726a003
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/3726a003

Branch: refs/heads/SUREFIRE-1403
Commit: 3726a003fc24897feabaf0633a107dd9ddf729fe
Parents: 1a65d61
Author: Tibor17 <ti...@apache.org>
Authored: Mon Aug 7 12:43:17 2017 +0200
Committer: Tibor17 <ti...@apache.org>
Committed: Mon Aug 7 12:43:17 2017 +0200

----------------------------------------------------------------------
 .../surefire/booterclient/ForkConfiguration.java      | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/3726a003/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java
index 1c7626e..a08fcaf 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java
@@ -41,6 +41,8 @@ import java.util.jar.JarEntry;
 import java.util.jar.JarOutputStream;
 import java.util.jar.Manifest;
 
+import static org.apache.commons.lang3.JavaVersion.JAVA_9;
+import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast;
 import static org.apache.maven.plugin.surefire.SurefireHelper.escapeToPlatformPath;
 
 /**
@@ -161,9 +163,15 @@ public class ForkConfiguration
 
         if ( argLine != null )
         {
-            cli.createArg().setLine(
-                   replaceThreadNumberPlaceholder( stripNewLines( replacePropertyExpressions( argLine ) ),
-                                                   threadNumber ) );
+            String jvmArgLine = replaceThreadNumberPlaceholder( stripNewLines( replacePropertyExpressions( argLine ) ),
+                                                                      threadNumber );
+
+            if ( isJavaVersionAtLeast( JAVA_9 ) && !jvmArgLine.contains( "--add-modules" ) )
+            {
+                jvmArgLine += " --add-modules ALL-SYSTEM";
+            }
+
+            cli.createArg().setLine( jvmArgLine );
         }
 
         for ( Map.Entry<String, String> entry : environmentVariables.entrySet() )