Search code examples
javaintellij-ideajava-9java-modulejava-platform-module-system

Module is not in dependencies Intellij IDEA 2017.2.5 Java 9


I just tested my java 9 module understanding in command line. Then I moved to Intellij IDEA 2017.2.5 to test it. There I am facing the error module is not in dependencies Don't know why intellij is showing the error.

I just write required statements in module-info.java as exports and requires.

Then I use Intellij intelligence to solve the error self by IDEA. Just ALT+ENTER then I click on Add dependency on module 'module-name-here'. But I don't know what Intellij doing behind the scene. Any idea about it?


Solution

  • But I don't know what Intellij doing behind the scene. Any idea about it?

    Its adding the modules to the module path of your current module. This is very similar to adding libraries/dependencies to classpath until Java8 to use the imports.

    The same can be done manually using the following steps:-

    ~> Project Settings 
    ~> Modules > Select module you want to add dependency to
    ~> Dependencies > Add dependency
    

    enter image description here