Closed ahtrotta closed 5 months ago
I debugged this and now think that it's not possible to fix this in our plugin.
"Run with AppMap" on 2023.1 and 2023.2 causes this exception. The exception is thrown in code of the IDE's Gradle plugin when our "Run with AppMap" runner triggers the execution after preparing the JVM commandline.
at com.intellij.openapi.roots.impl.ProjectFileIndexImpl.getModuleForFile(ProjectFileIndexImpl.java:90)
at org.jetbrains.plugins.gradle.execution.build.GradleBaseApplicationEnvironmentProvider.createExecutionEnvironment(GradleBaseApplicationEnvironmentProvider.kt:74)
Method getModuleForFile
is called without a ReadAction.
The code is executed async by the IDE's code and I don't see a way to hook into this to avoid the exception.
The API of run configurations of the SDK is very complex and mostly undocumented.
There's a GradleRunConfigurationProducer
which seems suitable to replace our runner for Gradle-based projects. But it's currently unclear if this could be used because it's seems to be unavailable in the JetBrains Gradle plugin distribution.
@dustinbyrne JetBrains replied that it's not possible to use GradleRunConfigurationProducer
, because it's packaged for internal-use only (which is unusual, to say the least). That rules out the alternative which doesn't allow us to fix the exception in the AppMap plugin.
In petclinic using
2023.2
this error occurs when usingRun with AppMap
: