Open FWiesner opened 1 year ago
Issue in Jetbrains' issue tracker: https://youtrack.jetbrains.com/issue/IDEA-337648/Unit-Testing-broken-when-using-GraalVM-23.1-polyglot-projects
Hi @FWiesner, thank you for reporting this. The link you shared is not accessible.
@selhagani You need a registered user in their issue tracker to see it
(this issue is for reference for other stumbling over the same problem, not a GraalVM issue)
Background: we have a project that is based on Maven (3.9.2) and try migrating it from GraalVM 23.0 to 23.1. Due to the packaging changes, with 23.1 the polyglot dependencies come from the Maven dependency graph and are no more installed via
gu
. We useSandboxPolicy.UNSTRUSTED
since 23.0 and have several JUnit 5 test cases that rely on the presence of the profile. These unit tests were executable in IntelliJ, but will not run anymore after the upgrade to 23.1.Internal Analysis Result: the GraalVM team (@chumer) was able to reproduce the issue and identified that the regression is caused by IntelliJ IDEA. In particular GraalVM 23.1 uses the JPMS ServiceLoader approach to find SPIs. But, this requires that the jars are on the module path instead of the class path. This means that the jars that are referenced by
should all end up on the module-path. When having a main class under
src/main/java
this works correctly and the SPIs can be found. But when IntelliJ on the other hand renders a unit test run configuration, the dependencies end up on the class path instead, breaking the SPI resolution.You then get something like this, even when using GraalVM (not GraalVM Community) and only in IntelliJ (Maven command line testing works):