问题描述
在使用Intellij Idea打开从别的地方拷来的Maven项目时(本示例也是个eclipse项目),总会遇到这样的情况,如图1所示:

可以看到,Idea左边的项目结构显示的很不友好,在网上查了一下,貌似遇到这种问题的人不少,但是都没有给出比较详细的方法,自己摸索了一下,发现居然解决了,于是便决定记下来,希望能帮助到大家。
解决办法
首先,打开项目的`Project Structure`,方法:左上角File->Project Structure。如图2所示:

打开后,在新弹出的界面中选择`Module`,如图3所示:

然后,点击界面中绿色的加号,选择`Import Module`,如图4所示:

点击`Import Module`之后,在新弹出的窗口,选择原来的项目,以我自己的为例(注意选好自己的项目),如图5所示:

选择好后,点击OK,进入下一页面。先选择`Import module from external model`,然后在下面选择`Maven`,如图6所示:

如图6所示,可以看出,还可以导入其他类型的项目,对于那些`Eclipse`项目,选择`Eclipse`就可以啦,我这里因为也是`Maven`项目,就选择用`Maven`啦,选择好后,点Next,进入如图7所示界面:

如图7所示,这里直接默认就好,点Next!进入图8(各个项目可能不一样啊),默认,点击Finish就好了:

点击finish之后,便看到如图9所示界面:

然后在点击OK,此时再看左上角的项目目录结构,就回复正常啦。如图10所示:

至此,就达成了目标,可以开始愉快的开发了。
网友评论
选中项目的pom文件,会自动导入的