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 2018/11/17 08:03:17 UTC
[maven-surefire] 01/01: [SUREFIRE-1531] Option to disable Java 9
modules
This is an automated email from the ASF dual-hosted git repository.
tibordigana pushed a commit to branch SUREFIRE-1531
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git
commit c39b00bbd90c2e6c11018c4988c20c164d7d6a1b
Author: Lukas Krecan <lu...@krecan.net>
AuthorDate: Sun Jul 1 08:54:22 2018 +0200
[SUREFIRE-1531] Option to disable Java 9 modules
---
.../plugin/surefire/AbstractSurefireMojo.java | 36 ++++++++++++++++++++--
1 file changed, 34 insertions(+), 2 deletions(-)
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 319f21d..062454b 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
@@ -104,6 +104,7 @@ import java.util.SortedSet;
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;
@@ -728,6 +729,20 @@ public abstract class AbstractSurefireMojo
@Parameter( property = "dependenciesToScan" )
private String[] dependenciesToScan;
+ /**
+ * Disables Jigsaw (Java 9) modular path even if <i>module-info.java</i> is used in project.
+ * <br>
+ * Enabled by default.
+ * If enabled, <i>module-info.java</i> exists and executes with JDK 9+, modular path is used.
+ *
+ * @since 3.0.0-M2
+ */
+ @Parameter( property = "useJigsawModules", defaultValue = "true" )
+ private boolean useJigsawModules;
+
+ /**
+ *
+ */
@Component
private ToolchainManager toolchainManager;
@@ -954,7 +969,7 @@ public abstract class AbstractSurefireMojo
if ( !getTestClassesDirectory().exists()
&& ( getDependenciesToScan() == null || getDependenciesToScan().length == 0 ) )
{
- if ( Boolean.TRUE.equals( getFailIfNoTests() ) )
+ if ( TRUE.equals( getFailIfNoTests() ) )
{
throw new MojoFailureException( "No tests to run!" );
}
@@ -2145,7 +2160,8 @@ public abstract class AbstractSurefireMojo
Platform platform = PLATFORM.withJdkExecAttributesForTests( getEffectiveJvm() );
- if ( platform.getJdkExecAttributesForTests().isJava9AtLeast() && existsModuleDescriptor() )
+ if ( platform.getJdkExecAttributesForTests().isJava9AtLeast()
+ && getUseJigsawModules() && existsModuleDescriptor() )
{
return new ModularClasspathForkConfiguration( bootClasspath,
tmpDir,
@@ -2414,6 +2430,7 @@ public abstract class AbstractSurefireMojo
checksum.add( getForkedProcessExitTimeoutInSeconds() );
checksum.add( getRerunFailingTestsCount() );
checksum.add( getTempDir() );
+ checksum.add( getUseJigsawModules() );
addPluginSpecificChecksumItems( checksum );
return checksum.getSha1();
}
@@ -3479,6 +3496,21 @@ public abstract class AbstractSurefireMojo
this.dependenciesToScan = dependenciesToScan;
}
+ public Boolean getUseJigsawModules()
+ {
+ return useJigsawModules;
+ }
+
+ public void setUseJigsawModules( Boolean useJigsawModules )
+ {
+ this.useJigsawModules = useJigsawModules;
+ }
+
+ public PluginDescriptor getPluginDescriptor()
+ {
+ return pluginDescriptor;
+ }
+
public MavenProject getProject()
{
return project;