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
When running a Maven build from Eclipse, test failures are observed due to the provides clauses in module-info.java descriptors not being honored. It appears that Eclipse is not using the module path.
Reproduction
I have created a minimal project that reproduces the issue. Please clone this repo
Select the parent pom.xml in the project explorer and use Run as -> Maven build...
Set goals as clean test
Set JRE as the default Eclipse JRE (on my install this points to $ECLIPSE_HOME/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.linux.x86_64_21.0.4.v20240802-1551/jre)
Run and find that the test fails:
[ERROR] test.project.SomeServiceTest.testFindingProviderInUnitTest -- Time elapsed: 0.014 s <<< ERROR!
java.util.ServiceConfigurationError: No provider implementation found
at project.spi.SomeService.lambda$getProvider$0(SomeService.java:24)
at java.base/java.util.Optional.orElseThrow(Optional.java:403)
at project.spi.SomeService.getProvider(SomeService.java:24)
at test.project.SomeServiceTest.testFindingProviderInUnitTest(SomeServiceTest.java:13)
Observation
When performing the same reproduction steps but changing the JRE to an Oracle JDK 21 the test passes, proving that the provides clauses in the module descriptor of the test project are used. Behavior therefore appears to differ between Oracle and Eclipse runtimes.
Possibly related is #1812 where the same reproduction project cannot run with Eclipse's build in Junit5 test runner.
Tested under this environment
OS & version
Linux 6.8.0-49-generic 49-Ubuntu SMP PREEMPT_DYNAMIC Mon Nov 4 02:06:24 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
This JDT project is not about maven, justj, JDK or project.spi. If you think you found a bug in JDT please boil it down to a reproducer in JDT. By now i can not see the relation to jdt.
Summary
When running a Maven build from Eclipse, test failures are observed due to the
provides
clauses inmodule-info.java
descriptors not being honored. It appears that Eclipse is not using the module path.Reproduction
I have created a minimal project that reproduces the issue. Please clone this repo
pom.xml
in the project explorer and useRun as
->Maven build...
clean test
$ECLIPSE_HOME/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.linux.x86_64_21.0.4.v20240802-1551/jre
)Observation
When performing the same reproduction steps but changing the JRE to an Oracle JDK 21 the test passes, proving that the
provides
clauses in the module descriptor of the test project are used. Behavior therefore appears to differ between Oracle and Eclipse runtimes.Possibly related is #1812 where the same reproduction project cannot run with Eclipse's build in Junit5 test runner.
Tested under this environment
Linux 6.8.0-49-generic 49-Ubuntu SMP PREEMPT_DYNAMIC Mon Nov 4 02:06:24 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Version: 2024-09 (4.33.0)
Build id: 20240905-0614
No additional plugins installed
java version "21.0.4" 2024-07-16 LTS
Java(TM) SE Runtime Environment (build 21.0.4+8-LTS-274)
Java HotSpot(TM) 64-Bit Server VM (build 21.0.4+8-LTS-274, mixed mode, sharing)
The text was updated successfully, but these errors were encountered: