Open ChrisHegarty opened 6 days ago
Pinging @elastic/es-delivery (Team:Delivery)
@rjernst I assume this is related to all the refactoring around native/jna stuff?
Pinging @elastic/es-core-infra (Team:Core/Infra)
This is a limitation of IntelliJ. Since the jdk21 provider is loaded through an MRJAR, it won't work in intellij. Test must be run either with JDK 17, or with the gradle runner.
So is this just that the additional sourcesets aren't on the runtime classpath when running in intellij? Could we hack this somehow?
Or more simply, given that the new minimum runtime version is Java 21, couldn't we collapse the MR sources down into the main
sourceset? For 9.0 the pre-21 implementations will never be used so why separate that in the MR jar> We should only use the MR jar for Java 22+ impls.
So is this just that the additional sourcesets aren't on the runtime classpath when running in intellij? Could we hack this somehow?
Unfortunately adding the additional sourcesets in a non MRJAR means there is jarhell. So we would have to relax our jarhell check, and then also add special handling to know how to fallback to the jdk 17 impl when not running on jdk 21+. It would be complicated, and I don't think worth it (we discussed when first adding native access).
given that the new minimum runtime version is Java 21, couldn't we collapse the MR sources down into the main sourceset
Yes, I plan to do this now that main is Java 21.
Is there any way to configure Gradle (or the import of our Grdle project into IntelliJ) so that tests depend upon the jar file of the native subproject, rather than the exploded classes? This would be much closer to actual runtime behaviour.
@ChrisHegarty for running those tests with gradle and the gradle runner in idea this should be possible
@ChrisHegarty for running those tests with gradle and the gradle runner in idea this should be possible
Right, we can configure Gradle to do this if we want (and in fact we do for MR jars I believe) but the root issue here is with the IDE so using the Gradle running kind of defeats the purpose.
Collapsing the source sets as Ryan says will solve this issue so I don't think we need to do anything else.
The following exception is often encountered with running tests with the IntelliJ test runner. Running tests with the Gradle runner is fine.