在构建我的[Gradle] + [Kotlin-JVM]项目时遇到了一个问题,其中时常会出现以下错误:
@NotNull method com/intellij/openapi/components/impl/ComponentManagerImpl.getMessageBus must not return null
我可以通过在Preferences > Build, Execution & Deployment > Build Tools > Gradle > Use Gradle from
下选择不同的Gradle安装来解决此问题,但是在对项目进行一些修改(通常是编辑一些代码)之后,它会再次中断。
如果我尝试直接在终端上使用gradlew,则效果很好。
这是我的build.gradle文件:
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.3.41'
}
group 'com.example.my_app'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
jcenter()
}
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.0-RC'
implementation 'org.jetbrains.kotlin:kotlin-script-runtime:1.3.41'
implementation 'com.github.ajalt:clikt:1.4.0'
implementation 'com.beust:klaxon:5.0.1'
implementation(platform('software.amazon.awssdk:bom:2.7.20'))
implementation 'software.amazon.awssdk:ssm'
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
作为旁注,我在IDE中不断收到以下错误消息
java.lang.IllegalArgumentException: Area already instantiated for: ProjectDefault (Template) Project
at com.intellij.openapi.extensions.Extensions.instantiateArea(Extensions.java:138)
at com.intellij.openapi.project.impl.ProjectImpl.bootstrapPicoContainer(ProjectImpl.java:148)
at com.intellij.openapi.project.impl.DefaultProject$1$1.init(DefaultProject.java:74)
at com.intellij.openapi.project.impl.DefaultProject$1.init(DefaultProject.java:104)
at com.intellij.openapi.project.impl.DefaultProjectTimed.get(DefaultProjectTimed.java:34)
at com.intellij.openapi.project.impl.DefaultProject.getDelegate(DefaultProject.java:131)
at com.intellij.openapi.project.impl.DefaultProject.getComponent(DefaultProject.java:216)
at com.intellij.openapi.wm.ToolWindowManager.getInstance(ToolWindowManager.java:26)
at net.orfjackal.sbt.plugin.SbtRunnerComponent.unregisterToolWindow(SbtRunnerComponent.java:117)
at net.orfjackal.sbt.plugin.SbtRunnerComponent.disposeComponent(SbtRunnerComponent.java:98)
at com.intellij.openapi.components.impl.ComponentManagerImpl.disposeComponents(ComponentManagerImpl.java:169)
at com.intellij.openapi.project.impl.ProjectImpl.dispose(ProjectImpl.java:330)
at com.intellij.openapi.util.Disposer$1.execute(Disposer.java:47)
at com.intellij.openapi.util.Disposer$1.execute(Disposer.java:43)
at com.intellij.openapi.util.objectTree.ObjectNode$1.execute(ObjectNode.java:135)
at com.intellij.openapi.util.objectTree.ObjectNode$1.execute(ObjectNode.java:104)
at com.intellij.openapi.util.objectTree.ObjectTree.executeActionWithRecursiveGuard(ObjectTree.java:194)
at com.intellij.openapi.util.objectTree.ObjectNode.execute(ObjectNode.java:104)
at com.intellij.openapi.util.objectTree.ObjectTree.executeAll(ObjectTree.java:142)
at com.intellij.openapi.util.Disposer.dispose(Disposer.java:136)
at com.intellij.openapi.util.Disposer.dispose(Disposer.java:132)
at com.intellij.util.Timed.dispose(Timed.java:41)
at com.intellij.util.TimedReference.dispose(TimedReference.java:8)
at com.intellij.openapi.project.impl.DefaultProjectTimed.lambda$null$0(DefaultProjectTimed.java:48)
at com.intellij.openapi.command.WriteCommandAction.lambda$runWriteCommandAction$5(WriteCommandAction.java:368)
at com.intellij.openapi.command.WriteCommandAction$BuilderImpl$1.run(WriteCommandAction.java:125)
at com.intellij.openapi.application.RunResult.run(RunResult.java:35)
at com.intellij.openapi.command.WriteCommandAction.lambda$null$1(WriteCommandAction.java:264)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:994)
at com.intellij.openapi.command.WriteCommandAction.lambda$performWriteCommandAction$2(WriteCommandAction.java:263)
at com.intellij.openapi.command.WriteCommandAction.lambda$doExecuteCommand$4(WriteCommandAction.java:320)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:220)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:188)
at com.intellij.openapi.command.WriteCommandAction.doExecuteCommand(WriteCommandAction.java:322)
at com.intellij.openapi.command.WriteCommandAction.performWriteCommandAction(WriteCommandAction.java:263)
at com.intellij.openapi.command.WriteCommandAction.execute(WriteCommandAction.java:245)
at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.run(WriteCommandAction.java:127)
at com.intellij.openapi.command.WriteCommandAction.runWriteCommandAction(WriteCommandAction.java:368)
at com.intellij.openapi.command.WriteCommandAction.runWriteCommandAction(WriteCommandAction.java:360)
at com.intellij.openapi.project.impl.DefaultProjectTimed.lambda$dispose$1(DefaultProjectTimed.java:48)
at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:82)
at com.intellij.openapi.application.TransactionGuardImpl.lambda$submitTransaction$1(TransactionGuardImpl.java:106)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.doRun(LaterInvocator.java:433)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:416)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:399)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:873)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:822)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:461)
at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:704)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:460)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)