I have an IntelliJ project composing several subprojects which are all Java 9 modules. I use Maven as a build system. My project has no "Facets". My run configuration looks like this:
My project settings look like this:
I can build everything with Maven just fine. However, when I try to compile with IntelliJ, it somehow thinks that my project is a Kotlin project and can't compile it:
Error:Kotlin: The Kotlin standard library is not found in the module graph. Please ensure you have the 'requires kotlin.stdlib' clause in your module definition
Has anyone any idea how to fix this? I already tried deleting the run configuration and recreated it. This fixes the problem for some time, but then it reappears randomly.
Even in 2019.1.3 that error is there .
A solution that always works for me is :
Build menu => Rebuild Project
Tested with JDK 12.0.1
That should be fixed though by IntelliJ team as soon as possible as more and more Java projects are passing to JDK 11 ++
Try to rebuild the module using Ctrl+Shift+F9 or right click on the module and select "Rebuild " in menu.
I had the same problem. I worked in a pure Java project managed with Maven. Till some days ago I applied the solution "rebuild" the project, but sometimes the error came back again.
After more investigation, I found that after disable "Enable migration detection" menu, the problem disappears.
I hope this helps.
Meanwhile, this can be fixed using the kotlin-stdlib.jar
available in Kotlin JavaRuntime:
module kotlin.test {
requires kotlin.stdlib;
}
where kotlin.test
should be replaced with your module name.
Just in case the details matter, I am using
IntelliJ IDEA 2018.3 (Community Edition)
Build #IC-183.4284.148, built on November 21, 2018
and the Kotlin JavaRunTime mentioned above has sources from the path Contents/plugins/Kotlin/kotlinc/lib
within the IntelliJ .app
which includes kotlin-stdlib.jar
as one of them.