You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2018/07/01 07:11:26 UTC

[GitHub] lukas-krecan closed pull request #189: [SUREFIRE-1531] Option to disable Java 9 modules

lukas-krecan closed pull request #189: [SUREFIRE-1531] Option to disable Java 9 modules
URL: https://github.com/apache/maven-surefire/pull/189
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
index fa1921468..cb81856f3 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
@@ -112,6 +112,7 @@
 import java.util.TreeSet;
 import java.util.concurrent.ConcurrentHashMap;
 
+import static java.lang.Boolean.TRUE;
 import static java.lang.Thread.currentThread;
 import static java.util.Arrays.asList;
 import static java.util.Collections.addAll;
@@ -753,6 +754,14 @@
     @Parameter( property = "dependenciesToScan" )
     private String[] dependenciesToScan;
 
+    /**
+     * Disables Java 9 modular classpath even if module-info.java is enabled
+     *
+     * @since 2.22.1
+     */
+    @Parameter( property = "disableModules" )
+    private Boolean disableModules;
+
     /**
      *
      */
@@ -985,7 +994,7 @@ boolean verifyParameters()
         if ( !getTestClassesDirectory().exists()
             && ( getDependenciesToScan() == null || getDependenciesToScan().length == 0 ) )
         {
-            if ( Boolean.TRUE.equals( getFailIfNoTests() ) )
+            if ( TRUE.equals( getFailIfNoTests() ) )
             {
                 throw new MojoFailureException( "No tests to run!" );
             }
@@ -2135,7 +2144,7 @@ private ForkConfiguration getForkConfiguration() throws MojoFailureException
 
         Platform platform = PLATFORM.withJdkExecAttributesForTests( getEffectiveJvm() );
 
-        if ( platform.getJdkExecAttributesForTests().isJava9AtLeast() && existsModuleDescriptor() )
+        if ( platform.getJdkExecAttributesForTests().isJava9AtLeast() && modulesEnabled() && existsModuleDescriptor() )
         {
             return new ModularClasspathForkConfiguration( bootClasspath,
                     tmpDir,
@@ -3671,6 +3680,21 @@ public void setDependenciesToScan( String[] dependenciesToScan )
         this.dependenciesToScan = dependenciesToScan;
     }
 
+    private boolean modulesEnabled()
+    {
+        return !TRUE.equals( getDisableModules() );
+    }
+
+    public Boolean getDisableModules()
+    {
+        return disableModules;
+    }
+
+    public void setDisableModules( Boolean disableModules )
+    {
+        this.disableModules = disableModules;
+    }
+
     public PluginDescriptor getPluginDescriptor()
     {
         return pluginDescriptor;


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services