“Module not specified” Error in IntelliJ.

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:

  1. ”Unmark” any resources, java or test folders in each module folder (“Right click/Cmd+click, choose “Mark Directiry As”).
  2. Go to File > Project Structure, select Modules under Project Settings.
  3. Click the Copy icon (next to the + and – icons).
  4. In the Copy Module dialog that pops up, select the source folder for your module under “Module file location”, click OK.
  5. 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).



Note to Self: How to Copy, Clone, Duplicate a Multi-Module Maven Project in IntelliJ

I’ve tried this with IntelliJ Ultimate 2018.3 on Windows 10 and it worked.

1. Copy/duplicate original project folder inside /IdeaProjects/ via the OS file explorer (not IntelliJ).

2. Delete it’s workspace.xml file inside .idea folder.

3. Delete its .git folder (since you’re starting a new project, based off an existing one).

4. Open the project (do not Import) via IntelliJ

5. IntelliJ might complain about a missing Git directory. Go to File > Settings, Version Control – delete anything in red, like . Click Apply & Ok.

6. Double check your Project Structure panel, make sure Modules language level is set to appropriate values for your code.

Continue reading