You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Set up a project with the sample sources, and verify that tests pass: mvn clean verify
Change the code (e.g., change the recipient from "world" to "Dagger")
Run the tests via an incremental compilation: mvn verify
Tests are expected to pass, but will fail.
Run tests via a full compilation: mvn clean verify
Tests will pass again.
Here is the error from step 3:
[ERROR] org.example.GreeterTest.getGreeting -- Time elapsed: 0.017 s <<< ERROR!
java.lang.NoClassDefFoundError: org/example/TestRecipientSupplier_Factory
at org.example.DaggerGreeterTest_TestComponent$TestComponentImpl.initialize(DaggerGreeterTest_TestComponent.java:55)
at org.example.DaggerGreeterTest_TestComponent$TestComponentImpl.<init>(DaggerGreeterTest_TestComponent.java:49)
at org.example.DaggerGreeterTest_TestComponent$Builder.build(DaggerGreeterTest_TestComponent.java:36)
at org.example.DaggerGreeterTest_TestComponent.create(DaggerGreeterTest_TestComponent.java:28)
at org.example.GreeterTest$TestComponent.createGreeter(GreeterTest.java:34)
at org.example.GreeterTest.getGreeting(GreeterTest.java:16)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
Caused by: java.lang.ClassNotFoundException: org.example.TestRecipientSupplier_Factory
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
... 9 more
For some reason, this bug does not happen with Gradle, though (./gradlew build, using Gradle 8.4). Here are the relevant Gradle files (both in the root directory), not including the Gradle build scripts:
Sample sources to reproduce this bug:
pom.xml
:Greeter.java
(main):GreeterTest.java
(test):TestRecipientSupplier.java
(test):Steps:
mvn clean verify
mvn verify
mvn clean verify
Here is the error from step 3:
Here's the output of
mvn -v
(on Ubuntu 22.04):The text was updated successfully, but these errors were encountered: