简体   繁体   中英

How to re-add module to a project in IntelliJ?

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

  1. How to put module back?

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

  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.

  • Open Module Settings
  • Click on "+"
  • Click on Import Module
  • Chose Wikidata.iml from your folder structure

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM