Search code examples
javaintellij-ideajava-11java-modulemodule-info

Intellij: Java 11: export module: package not found {module not found}, module-info.java


I'm trying to create a simple modular programming application.

My project consists of two modules-

  1. com.module.model

  2. com.module.util

when I'm trying to export the module com.module.model in module-info.java.

IntelliJ cannot find the package to import.

(However it should give me the error of module not found)

The same problem stands for 'requires module' too.

I have provided all the modules in the dependencies for com.module.model

com.module.model

module dependency

Solutions I already tried-

  1. Build the modules separately (before adding the export line) and the whole project (maven clean install) as whole.

  2. Invalidated caches and restarted.

  3. SDK and Language level is set to 11.


Solution

  • You need to create those packages com.module.model and the like within the java folder of your IntelliJ project.

    Within IntelliJ, the directory that you've named as com.module.model is the "IntelliJ module" name and has no relation with the "Java module system", in that you would be using the artifact generated out of this project.

    To add a screenshot on the similar lines as of the question. It would look like:

    enter image description here