Seems like while using a modular project to test
, you need to have forkCount
set as 0
:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M1</version>
<configuration>
<forkCount>0</forkCount> <!-- changed this to 0 -->
<reuseForks>false</reuseForks>
<!-- <threadCount>1</threadCount> --> <!-- shall be used with 'parallel' -->
<printSummary>true</printSummary>
<!-- <skipTests>false</skipTests> --> <!-- defaults to false -->
<!-- run test in headless mode -->
<systemPropertyVariables>
<glass.platform>Monocle</glass.platform>
<monocle.platform>Headless</monocle.platform>
<prism.order>d3d</prism.order>
</systemPropertyVariables>
<argLine>
--add-exports javafx.graphics/com.sun.javafx.application=ALL-UNNAMED
--add-exports javafx.graphics/com.sun.glass.ui=ALL-UNNAMED
</argLine>
</configuration>
</plugin>
Quoting from this article
When module-info.java
is present and fork process is enabled, surefire
creates a mixed classpath with modules and unnamed modules causing
module visibility issues and preventing the application to start.
Note: Disabling the forkCount
and reuseForks
configuration parameters, results in org.apache.maven.surefire.booter.SurefireBooterForkException
being thrown, similar to the one reported in SUREFIRE-1528.
If this could help the developers at Maven community, the execution dump from the same run reads the following:
# Created at 2018-11-23T09:31:53.631
Corrupted STDOUT by directly writing to native stream in forked JVM 1. Stream 'Error occurred during initialization of boot layer'.
java.lang.IllegalArgumentException: Stream stdin corrupted. Expected comma after third character in command 'Error occurred during initialization of boot layer'.
at org.apache.maven.plugin.surefire.booterclient.output.ForkClient$OperationalData.<init>(ForkClient.java:507)
at org.apache.maven.plugin.surefire.booterclient.output.ForkClient.processLine(ForkClient.java:210)
at org.apache.maven.plugin.surefire.booterclient.output.ForkClient.consumeLine(ForkClient.java:177)
at org.apache.maven.plugin.surefire.booterclient.output.ThreadedStreamConsumer$Pumper.run(ThreadedStreamConsumer.java:88)
at java.base/java.lang.Thread.run(Thread.java:834)
Here is the line of code in the source repository.
module-info
class is interfering with the test. I've removed it and the test works fine. Probably the plugin is not ready for modular projects yet? Also there is an issue with the module itself (due to wrong openjfx-monocle dependencies probably). – Injunction