Issue
I'm trying to create a simple modular programming application.
My project consists of two modules-
com.module.model
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
Solutions I already tried-
Build the modules separately (before adding the export line) and the whole project (maven clean install) as whole.
Invalidated caches and restarted.
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:
Answered By - Naman
Answer Checked By - Candace Johnson (JavaFixing Volunteer)