13

I had a project with small code sample snippets, grouped by modules, like this:

enter image description here

Each module has individual POM file and no (apparently) global one.

Previously I had one more module, called Wikidata. At some moment IntelliJ said, that this module was "removed from Maven structure" and suggested to removed from project too. I agreed and now it is gone. It is still on disk in separate folder.

My questions are

  1. How to put module back?

  2. What was that "maven structure", from which module was removed and how to control this structure?

Ahmed Ashour
  • 5,179
  • 10
  • 35
  • 56
Dims
  • 47,675
  • 117
  • 331
  • 600

4 Answers4

29
  1. Go to Settings>Build, Execution, Deployment>Build Tools>Maven>Ignored Files
  2. Uncheck the files
  3. Write your code
  4. ...
  5. Profit

With regard to the maven structure. It seems that you removed the modules from one of the pom.xml files that was using it and then IntelliJ saw this and suggested that since you're no longer building these files, then perhaps you'd like to remove them.

Craig
  • 2,286
  • 3
  • 24
  • 37
6
  • Open Module Settings
  • Click on "+"
  • Click on Import Module
  • Chose Wikidata.iml from your folder structure

Maybe combine this with Craigs answer.

Stefan Sprenger
  • 1,050
  • 20
  • 42
5

In your .idea directory you can find a modules.xml file. Open it and just add

<module fileurl="file://$PROJECT_DIR$/path_to_your_project/your_project.iml" filepath="$PROJECT_DIR$/path_to_your_project/your_project.iml" />

to the modules-element. After this the module is marked with the blue square again.

michaeak
  • 1,548
  • 1
  • 12
  • 23
3

Add by choosing "Maven"-> "+" Add Maven projects -> "pom.xml" of module you want to add. enter image description here

enter image description here

enter image description here

anand krish
  • 4,281
  • 4
  • 44
  • 47