Andy Wilkinson opened SPR-16977 and commented
It appears the classpath scanning doesn't work when Surefire launches the JVM configured to use the module path. target/classes is placed on the module path and target/test-classes is patched into this module but classpath scanning only finds classes in target/test-classes.
I have attached a minimal sample that should reproduce the problem when built (mvn test) with Java 10. The sysout from the test should show that only the test class has been found:
[INFO] Running com.example.ScanningTest
[file [/Users/awilkinson/dev/temp/module-path-scanning/target/test-classes/com/example/ScanningTest.class]]
To my rather untrained eye, building with -X and examining the arguments that Surefire uses to launch the forked JVM (in target/surefire) suggests that Surefire's configuration of the JVM is correct.
When the sample is modified to work with Java 8 (remove module-info.java and change the compiler plugin configuration to remove <release>10</release>) the class in target/classes is also found:
[INFO] Running com.example.ScanningTest
[file [/Users/awilkinson/dev/temp/module-path-scanning/target/test-classes/com/example/ScanningTest.class], file [/Users/awilkinson/dev/temp/module-path-scanning/target/classes/com/example/One.class]]
Affects: 5.0.7
Reference URL: spring-projects/spring-boot#13581
Attachments:
Issue Links:
2 votes, 7 watchers
Andy Wilkinson opened SPR-16977 and commented
It appears the classpath scanning doesn't work when Surefire launches the JVM configured to use the module path.
target/classesis placed on the module path andtarget/test-classesis patched into this module but classpath scanning only finds classes intarget/test-classes.I have attached a minimal sample that should reproduce the problem when built (
mvn test) with Java 10. The sysout from the test should show that only the test class has been found:To my rather untrained eye, building with
-Xand examining the arguments that Surefire uses to launch the forked JVM (intarget/surefire) suggests that Surefire's configuration of the JVM is correct.When the sample is modified to work with Java 8 (remove
module-info.javaand change the compiler plugin configuration to remove<release>10</release>) the class intarget/classesis also found:Affects: 5.0.7
Reference URL: spring-projects/spring-boot#13581
Attachments:
Issue Links:
2 votes, 7 watchers