Exclude test code on launch configuration - Error: Could not find or load main class
The Exclude test code on Dependencies of the app launch configuration does not work as expected.
If you check this mark it would not be able to run your app anymore resulting with the error:
Error: Could not find or load main class com.example.demo.DemoApplication
Caused by: java.lang.ClassNotFoundException: com.example.demo.DemoApplication
Please find the detailed instruction how to reproduce and demo project at: https://github.com/engilyin/eclipse-test-classpath-exclusion-bug
Just import it into the Eclipse. Run the com.example.demo.DemoApplication and make sure it works but includes all sources including the test and integration-test. Turn on the Exclude test code on Dependencies and find that instead of expected behavior it results with the error.
I tested on most recent available build: Version: 2024-12 (4.34.0) Build id: 20241128-0757
Java 21 Gradle and Spring Boot 3.4.2