I had a project with small code sample snippets, grouped by modules, like this:
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
How to put module back?
What was that "maven structure", from which module was removed and how to control this structure?
Import an existing moduleFrom the main menu, select File | New | Module from Existing Sources. In the dialog that opens, specify the path the . iml file of the module that you want to import, and click Open. By doing so, you are attaching another module to the project without physically moving any files.
Go to File > Settings > Maven > Ignored Files and uncheck the ignored files. Then re-import the module, shouldn't be greyed out anymore. Worked for me too.
Add a new module to your project by clicking File > New > New Module. Provides a container for your app's source code, resource files, and app level settings such as the module-level build file and Android Manifest file. When you create a new project, the default module name is "app".
From the main menu, select File | Project Structure | Project Settings | Modules. Select the module for which you want to set an SDK and click Dependencies. If the necessary SDK is already defined in IntelliJ IDEA, select it from the Module SDK list.
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.
Maybe combine this with Craigs answer.
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.
Add by choosing "Maven"-> "+" Add Maven projects -> "pom.xml"
of module you want to add.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With