This happened after I renamed the modules to more descriptive logical names in IntelliJ 2018.3, Ultimate Edition. As a result, my two Maven module folders were no longer marked as modules in IntelliJ (no blue square in the bottom right corner of the folder icon in the Project panel). To solve the issue, I did the following:
- ”Unmark” any resources, java or test folders in each module folder (“Right click/Cmd+click, choose “Mark Directiry As”).
- Go to File > Project Structure, select Modules under Project Settings.
- Click the Copy icon (next to the + and – icons).
- In the Copy Module dialog that pops up, select the source folder for your module under “Module file location”, click OK.
- Open your Run Configuration screen. If “Use classpath of module” still only offers “no module”, back up any of your Run Config settings & options, then delete the old configuration and Add New Configuration (+ icon).