You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Tibor Digana (Jira)" <ji...@apache.org> on 2019/10/29 00:12:00 UTC

[jira] [Commented] (SUREFIRE-1680) Startup exception ClassNotFoundException of StartupReportConfiguration with module-info.java

    [ https://issues.apache.org/jira/browse/SUREFIRE-1680?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16961571#comment-16961571 ] 

Tibor Digana commented on SUREFIRE-1680:
----------------------------------------

[~roy_williams]
I am using JDK version:
java version "12" 2019-03-19
Java(TM) SE Runtime Environment (build 12+33)
Java HotSpot(TM) 64-Bit Server VM (build 12+33, mixed mode, sharing)

and I am able to reproduce this issue with Surefire 3.0.0-M3 but the issue cannot be reproduced with {{3.0.0-SNAPSHOT}} which is the future {{3.0.0-M4}}. See the build result with development version:

{noformat}
mvn -nsu test
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building SurefireStartupIssue 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.4:prepare-agent (pre-unit-test) @ SurefireStartupIssue ---
[INFO] argLine set to -javaagent:c:\\Users\\tibor17\\.m2\\repository\\org\\jacoco\\org.jacoco.agent\\0.8.4\\org.jacoco.agent-0.8.4-runtime.jar=destfile=C:\\vcs\\github\\SurefireStartupIssue\\target\\coverage-reports\\jacoco-unit-test.exec
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ SurefireStartupIssue ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ SurefireStartupIssue ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to C:\vcs\github\SurefireStartupIssue\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ SurefireStartupIssue ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\vcs\github\SurefireStartupIssue\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ SurefireStartupIssue ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\vcs\github\SurefireStartupIssue\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:3.0.0-SNAPSHOT:test (default-test) @ SurefireStartupIssue ---
[INFO]
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.samplebiz.surefirestartupissue.MainTest
01:05:19.731 [main] INFO  com.samplebiz.surefirestartupissue.Main - Main starting
Hello world!
01:05:19.765 [main] INFO  com.samplebiz.surefirestartupissue.Main - Main finished
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.557 s - in com.samplebiz.surefirestartupissue.MainTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.4:report (post-unit-test) @ SurefireStartupIssue ---
[INFO] Loading execution data file C:\vcs\github\SurefireStartupIssue\target\coverage-reports\jacoco-unit-test.exec
[INFO] Analyzed bundle 'SurefireStartupIssue' with 1 classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17.373 s
[INFO] Finished at: 2019-10-29T01:05:20+01:00
[INFO] Final Memory: 28M/94M
[INFO] ------------------------------------------------------------------------
{noformat}


> Startup exception ClassNotFoundException of StartupReportConfiguration with module-info.java
> --------------------------------------------------------------------------------------------
>
>                 Key: SUREFIRE-1680
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1680
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: classloading, Maven Surefire Plugin
>    Affects Versions: 2.22.2, 3.0.0-M3
>         Environment: $ 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"
>            Reporter: Roy Williams
>            Assignee: Tibor Digana
>            Priority: Major
>             Fix For: 3.0.0-M4
>
>         Attachments: SurefireStartupIssue.zip, build.out.txt
>
>
> 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.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)