Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Works for Me
-
2.22.2, 3.0.0-M3
-
None
-
None
-
$ java -version
java version "12.0.1" 2019-04-16
Java(TM) SE Runtime Environment (build 12.0.1+12)
Java HotSpot(TM) 64-Bit Server VM (build 12.0.1+12, mixed mode, sharing)
$ mvn -version # 3.6.0 or above required for JDK12
Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-04T13:00:29-06:00)
Maven home: C:\Apps\maven\apache-maven-3.6.1
Java version: 12.0.1, vendor: Oracle Corporation, runtime: C:\Program Files\Java\12
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
$ java -version java version "12.0.1" 2019-04-16 Java(TM) SE Runtime Environment (build 12.0.1+12) Java HotSpot(TM) 64-Bit Server VM (build 12.0.1+12, mixed mode, sharing) $ mvn -version # 3.6.0 or above required for JDK12 Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-04T13:00:29-06:00) Maven home: C:\Apps\maven\apache-maven-3.6.1 Java version: 12.0.1, vendor: Oracle Corporation, runtime: C:\Program Files\Java\12 Default locale: en_US, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
Description
As surefire-plugin is starting up during the build it crashes out with a series of exceptions. The junit tests are not performed. Tracing through the attached build.out.txt (see attachments) suggests the ClassNotFoundException is a result of a SurefireReflectionException. Not sure if my interpretation is accurate.
This started occurring on my application upon migrating from JDK8 to JDK12. I have a purpose for their 'jlink' tool. JDK12 is the target delivery vehicle.
A project zip is attached that contains one Main.class and files required to build it. It is a dirt simple reproduction of my problem.
I am hoping that someone on the surefire team can unzip it and try to reproduce my issue.
If the <skipTests> flag is set to true, the little toy executable will actually build up and can be executed on the command line. Proves that JDK is able to handle its modules correctly. It can be run by unzipping the distribution assembly and run with the command ...
cd target; unzip SurefireStartupIssue-dist.zip; cd SurefireStartupIssue
java --module-path '.;lib' -m SurefireStartupIssue/com.samplebiz.surefirestartupissue.Main
Crude workaround (temporarily disable Java Modules):
- Rename your ‘module-info.java’ file <tempfile>.
- Make surefire configuration has <skipTests>false</skipTests>
- Run tests… all should pass.
- When done with tests, restore ‘module-info.java to enable Java modules.