How to keep module structure after import?

Answered

1. New Empty project -> New module "subModule": Maven(maven-archtype-webapp) -> Add framework support: Spring MVC

2. Upload everything(include .iml, .idea, ...etc)  to remote Git repository

 

Directory Tree in [Project] panel:

subModule/

- src/

--- main/

--- test/

- pom.xml

- subModule.iml

 

Now, if I clone and import the repository in IntelliJ IDEA, I can't restore my Spring project. IntelliJ doesn't recognize it as Spring framework.

 

Directory Tree in [Project] panel (after import):

main/

- main.iml

test/

- test.iml

pom.xml

subModule.iml

 

Also directory hierarchy is broken after import project.

Is it impossible to restore the structure of imported module completely?

0
3 comments

IntelliJ IDEA project information is stored one level above the module in this case and is not shared via the version control.

Either change the location of the IDE project files when creating a new project or commit the entire project directory with .idea subdirectory: https://intellij-support.jetbrains.com/hc/articles/206544839.

When you import the current project from pom.xml, this module becomes the new project root as there is nowhere to get the information about the subModule structure.

0
Avatar
Permanently deleted user

Is project information stored in .idea folder, instead of .iml file?

If so aren't there any ways to share multiple modules under empty project correctly?

0

.idea directory stores the project information. .iml files store the module information only.

0

Please sign in to leave a comment.