Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run as Maven build fails with Eclipse JRE #1814

Closed
xazap opened this issue Nov 26, 2024 · 2 comments
Closed

Run as Maven build fails with Eclipse JRE #1814

xazap opened this issue Nov 26, 2024 · 2 comments
Labels
needinfo Further information is requested

Comments

@xazap
Copy link

xazap commented Nov 26, 2024

Summary

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
  • Eclipse IDE/Platform version:
    Version: 2024-09 (4.33.0)
    Build id: 20240905-0614
    No additional plugins installed
  • Oracle JDK:
    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)
@jukzi
Copy link
Contributor

jukzi commented Nov 28, 2024

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.

@jukzi jukzi added the needinfo Further information is requested label Nov 28, 2024
@jukzi
Copy link
Contributor

jukzi commented Jan 2, 2025

Closing without enough information after months.

@jukzi jukzi closed this as not planned Won't fix, can't repro, duplicate, stale Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needinfo Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants