Unit tests fail on Apple Silicon with Gradle :test task but pass with JUnit test runner


NOTE: This is an update to Plugin tests are failing on Apple Silicon. I also submitted it to YouTrack as IDEA-304723, but it's not really an IntelliJ bug.

I have an IDEA plugin that has failing unit tests on a new Apple Silicon MacBook, but these tests pass on AMD64 platforms, including an older MacBook and a GitHub Actions runner. All three tests appear to be failing due to an error loading the JNA library. The plugin itself works on all platforms, the only problem is with these tests.

The failing tests all pass on Apple Silicon if I use a JUnit run configuration in IntelliJ instead of just running  `gradlew :test`. So, this appears to be a Gradle configuration issue, but I cannot figure out where the problem is. The plugin supports IDEA 2022.1+, and is being built against IC-2022.1 with Gradle IntelliJ Plugin v1.9.0, so Apple Silicon should be fully supported.

Please see build.gradle.kts and issues/1 in the plugin GitHub repo for more details (sorry, I can't figure out how to paste code here without completely breaking formatting).







I forgot to add that the dev-junit5 branch of the plugin repo has the relevant code to reproduce this issue.


Could you please try if upgrading to gradle-intellij-plugin 1.10.0 helps here? https://github.com/mdklatt/idea-netcdf-plugin/blob/dev-junit5/build.gradle.kts#L12


This does not fix the Gradle tests, and now some of the JUnit tests fail as well due to class loader exceptions. e.g. java.lang.NoClassDefFoundError: com/intellij/ui/treeStructure/Tree. I am using the -Didea.force.use.core.classloader=true workaround for the JUnit run configuration; disabling this makes no difference.


Yann Cebron

After upgrading the Gradle IJ plugin to 1.11.0-SNAPSHOT, the JUnit tests are working again, but Gradle tests fail the same way as before.


plugins {
kotlin("jvm") version("1.7.10")
id("org.jetbrains.intellij") version("1.11.0-SNAPSHOT")
id("org.jetbrains.changelog") version("1.3.1")

Is this issue still occuring with 1.12.0?


Upgrading the Gradle plugin to v1.13.3 fixes this issue. All tests are passing with the Gradle test runner on AMD64 and ARM64 machines.