JetBrains / intellij-platform-gradle-plugin

Gradle plugin for building plugins for IntelliJ-based IDEs
https://plugins.jetbrains.com/docs/intellij/gradle-prerequisites.html
Apache License 2.0
1.43k stars 271 forks source link

MacOS throw errors like `JNA library is not available` after upgrade to 2.x #1815

Open shihanMS opened 4 days ago

shihanMS commented 4 days ago

What happened?

MacOS throw errors like JNA library is not available after upgrade to 2.x in IDEA Community 2024.1. However, it works well with pairs 1.17.3, IC 2024.1 and 2.x, IC 2023.3. Similar problems with https://youtrack.jetbrains.com/issue/IJPL-1467/macOs-Could-not-initialize-class-com.intellij.ui.mac.foundation.Foundation-on-223.6160.11-build It also happens to windows with 2.x and IC 2024.2

Relevant log output or stack trace

java.lang.RuntimeException: java.lang.AssertionError: JNA library is not available
    at com.intellij.openapi.application.impl.LaterInvocator.invokeAndWait(LaterInvocator.java:132)
    at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:412)
    at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:431)
    at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl.configureInner(CodeInsightTestFixtureImpl.java:1617)
    at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl.configureByText(CodeInsightTestFixtureImpl.java:1541)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at com.intellij.testFramework.UsefulTestCase.lambda$wrapTestRunnable$13(UsefulTestCase.java:504)
    at com.intellij.testFramework.UsefulTestCase.runTestRunnable(UsefulTestCase.java:408)
    at com.intellij.testFramework.fixtures.BasePlatformTestCase.runTestRunnable(BasePlatformTestCase.java:109)
    at com.intellij.testFramework.UsefulTestCase.defaultRunBare(UsefulTestCase.java:424)
    at com.intellij.testFramework.UsefulTestCase.runBare(UsefulTestCase.java:494)
    at com.intellij.testFramework.UsefulTestCase$1.evaluate(UsefulTestCase.java:156)
    at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
    at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
    at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
    at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
    at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
    at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:108)
    at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:58)
    at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:40)
    at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:60)
    at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:52)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
    at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
    at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
    at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
    at jdk.proxy2/jdk.proxy2.$Proxy5.processTestClass(Unknown Source)
    at org.gradle.api.internal.tasks.testing.worker.TestWorker$2.run(TestWorker.java:176)
    at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129)
    at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100)
    at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60)
    at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
    at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:113)
    at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:65)
    at worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
    at worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)
Caused by: java.lang.AssertionError: JNA library is not available
    at com.intellij.ui.mac.foundation.Foundation.<clinit>(Foundation.java:30)
    at com.intellij.ui.mac.foundation.Foundation$NSAutoreleasePool.<init>(Foundation.java:491)
    at com.intellij.ui.components.MacScrollBarUI.callMac(MacScrollBarUI.java:181)
    at com.intellij.ui.components.MacScrollBarUI$Native.<init>(MacScrollBarUI.java:279)
    at com.intellij.ui.components.MacScrollBarUI$Style$1.<init>(MacScrollBarUI.java:231)
    at com.intellij.ui.components.MacScrollBarUI$Style.<clinit>(MacScrollBarUI.java:231)
    at com.intellij.ui.components.MacScrollBarUI.installUI(MacScrollBarUI.java:86)
    at java.desktop/javax.swing.JComponent.setUI(JComponent.java:733)
    at java.desktop/javax.swing.JScrollBar.setUI(JScrollBar.java:218)
    at com.intellij.openapi.editor.impl.EditorImpl$MyScrollBar.setUI(EditorImpl.java:3323)
    at com.intellij.ui.components.JBScrollBar.updateUI(JBScrollBar.java:87)
    at java.desktop/javax.swing.JScrollBar.<init>(JScrollBar.java:173)
    at com.intellij.ui.components.JBScrollBar.<init>(JBScrollBar.java:65)
    at com.intellij.ui.components.JBScrollBar.<init>(JBScrollBar.java:61)
    at com.intellij.openapi.editor.impl.EditorImpl$OpaqueAwareScrollBar.<init>(EditorImpl.java:3279)
    at com.intellij.openapi.editor.impl.EditorImpl$MyScrollBar.<init>(EditorImpl.java:3312)
    at com.intellij.openapi.editor.impl.EditorImpl$MyScrollPane.createVerticalScrollBar(EditorImpl.java:5500)
    at java.desktop/javax.swing.JScrollPane.<init>(JScrollPane.java:301)
    at java.desktop/javax.swing.JScrollPane.<init>(JScrollPane.java:353)
    at com.intellij.ui.components.JBScrollPane.<init>(JBScrollPane.java:83)
    at com.intellij.openapi.editor.impl.EditorImpl$MyScrollPane.<init>(EditorImpl.java:5437)
    at com.intellij.openapi.editor.impl.EditorImpl.<init>(EditorImpl.java:366)
    at com.intellij.openapi.editor.impl.EditorFactoryImpl.doCreateEditor(EditorFactoryImpl.java:222)
    at com.intellij.openapi.editor.impl.EditorFactoryImpl.createEditor(EditorFactoryImpl.java:203)
    at com.intellij.openapi.editor.impl.EditorFactoryImpl.createEditor(EditorFactoryImpl.java:158)
    at com.intellij.openapi.fileEditor.impl.TestEditorManagerImpl.doOpenTextEditor(TestEditorManagerImpl.kt:471)
    at com.intellij.openapi.fileEditor.impl.TestEditorManagerImpl.openFileImpl3(TestEditorManagerImpl.kt:159)
    at com.intellij.openapi.fileEditor.impl.TestEditorManagerImpl.openFileInCommand$lambda$6(TestEditorManagerImpl.kt:451)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:225)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:177)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:167)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:153)
    at com.intellij.openapi.fileEditor.impl.TestEditorManagerImpl.openFileInCommand(TestEditorManagerImpl.kt:450)
    at com.intellij.openapi.fileEditor.impl.TestEditorManagerImpl.openTextEditor(TestEditorManagerImpl.kt:440)
    at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl.createEditor(CodeInsightTestFixtureImpl.java:1702)
    at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl.lambda$configureInner$56(CodeInsightTestFixtureImpl.java:1642)
    at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:209)
    at com.intellij.openapi.application.TransactionGuardImpl.access$100(TransactionGuardImpl.java:22)
    at com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:191)
    at com.intellij.openapi.application.impl.RwLockHolder.runIntendedWriteActionOnCurrentThread(RwLockHolder.kt:204)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:830)
    at com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:419)
    at com.intellij.openapi.application.impl.LaterInvocator$1.run(LaterInvocator.java:101)
    at com.intellij.openapi.application.impl.RwLockHolder.runWithEnabledImplicitRead(RwLockHolder.kt:138)
    at com.intellij.openapi.application.impl.RwLockHolder.runWithImplicitRead(RwLockHolder.kt:129)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWithImplicitRead(ApplicationImpl.java:1152)
    at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:81)
    at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:123)
    at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:43)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:792)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:739)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:733)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:761)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:698)
    at com.intellij.ide.IdeEventQueue._dispatchEvent$lambda$12(IdeEventQueue.kt:593)
    at com.intellij.openapi.application.impl.RwLockHolder.runWithoutImplicitRead(RwLockHolder.kt:105)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:593)
    at com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:77)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:362)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:361)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:843)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:361)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:356)
    at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:1021)
    at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:114)
    at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:1021)
    at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$7(IdeEventQueue.kt:356)
    at com.intellij.openapi.application.impl.RwLockHolder.runIntendedWriteActionOnCurrentThread(RwLockHolder.kt:209)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:830)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:398)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)

Steps to reproduce

Not able to provide whole build configuration, let me know if you need some extra information

plugins {
    id("org.jetbrains.intellij.platform") version "2.1.0"
}

repositories {
        maven("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies")
        mavenLocal()
        mavenCentral()
        intellijPlatform {
            defaultRepositories()
            marketplace()
        }
    }

  dependencies {
      intellijPlatform {
          intellijIdeaCommunity("2024.1")
          instrumentationTools()
          testFramework(TestFrameworkType.Platform)
          pluginVerifier()
      }
}

Gradle IntelliJ Plugin version

2.x

Gradle version

8.2

Operating System

macOS

Link to build, i.e. failing GitHub Action job

No response

hsz commented 2 days ago

Thanks for reporting, @shihanMS!

A few questions:

  1. Which SDK have you set in your IDE in the Project Settings?
  2. Is your MacOS based on Intel or Apple Silicon chipset?
shihanMS commented 2 days ago

Which SDK have you set in your IDE in the Project Settings?

corretto 17

Is your MacOS based on Intel or Apple Silicon chipset?

We run github actions using macos-latest, and it is based on Apple Silicon (M1). However, we also reproduce this error on mac mini based on 3 GHz 6-Core Intel Core i5

Thanks for your reply @hsz , if need any other information please let me know.

hsz commented 1 day ago
  1. Which task is failing for you, runIde or buildSearchableOptions?

  2. Please register and call the following task so we'll see what IntelliJ Platform distribution you use:

    tasks.register("printInfo") {
        val data = provider {
            intellijPlatform.productInfo.launch.joinToString(";") { "os=${it.os} arch=${it.arch}" }
        }
        doLast {
            println(data.get())
        }
    }
shihanMS commented 1 day ago
  1. Actually it is task Test we registered
  2. 
    > Configure project :
    Kotlin DSL property assignment is an incubating feature.
    Loading platform config from /Users/vscjava/repos/***
    Setting ideVersion to 2024.1
    Setting ideType to IC

Task :printInfo os=macOS, arch=amd64

Besides, we find some jna clues in logs, it seems there is dependency conflict, do not know if it helps:

Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.Error: 
    There is an incompatible JNA native library installed on this system
    Expected: 6.1.4
    Found:    7.0.0
    (at /Users/vscjava/.gradle/caches/transforms-3/a76f981706ac2d10c4f245ca617352c2/transformed/ideaIC-2024.1/lib/jna/amd64/libjnidispatch.jnilib).
    To resolve this issue you may do one of the following:
     - remove or uninstall the offending library
     - set the system property jna.nosys=true
     - set jna.boot.library.path to include the path to the version of the 
       jnidispatch library included with the JNA jar file you are using
       at com.sun.jna.Native.<clinit>(Native.java:230)
        at com.intellij.jna.JnaLoader.load(JnaLoader.java:19)
        at com.intellij.jna.JnaLoader.isLoaded(JnaLoader.java:35)