This is an automated email from the ASF dual-hosted git repository. tibordigana pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-surefire.git
The following commit(s) were added to refs/heads/master by this push: new f977237 [SUREFIRE-1809] Differences between Oracle JDK and AdoptOpenJDK caused by JPMS f977237 is described below commit f9772370749cc9fa19638159f0b29e3be6794614 Author: tibordigana <tibordig...@apache.org> AuthorDate: Tue Jun 30 15:46:27 2020 +0200 [SUREFIRE-1809] Differences between Oracle JDK and AdoptOpenJDK caused by JPMS --- .../maven/plugin/surefire/AbstractSurefireMojo.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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 38d34fb..64975b4 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 @@ -119,6 +119,7 @@ import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; import java.util.concurrent.ConcurrentHashMap; +import java.util.zip.ZipFile; import static java.lang.Boolean.TRUE; import static java.lang.Integer.parseInt; @@ -1397,7 +1398,10 @@ public abstract class AbstractSurefireMojo private ResolvePathResultWrapper findModuleDescriptor( File jdkHome, File buildPath, boolean isMainDescriptor ) { - if ( buildPath.isDirectory() && !new File( buildPath, "module-info.class" ).exists() ) + boolean isJpmsModule = + buildPath.isDirectory() ? new File( buildPath, "module-info.class" ).exists() : isModule( buildPath ); + + if ( !isJpmsModule ) { return new ResolvePathResultWrapper( null, isMainDescriptor ); } @@ -1415,6 +1419,18 @@ public abstract class AbstractSurefireMojo } } + private static boolean isModule( File jar ) + { + try ( ZipFile zip = new ZipFile( jar ) ) + { + return zip.getEntry( "module-info.class" ) != null; + } + catch ( IOException e ) + { + return false; + } + } + private boolean canExecuteProviderWithModularPath( @Nonnull Platform platform, @Nonnull ResolvePathResultWrapper resolvedJavaModularityResult ) {