我是靠谱客的博主 寒冷马里奥,最近开发中收集的这篇文章主要介绍idea中的iml文件_IntelliJ IDE | .iml文件丢失或删除,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

Last week I was working on a Java EE project with IntelliJ IDE.

Today: As I started up my IntelliJ 2016.1 it gave me the error:

Error Loading Project

Cannot load module FirstWebApp

As I looked at the details it said it couldnot find my FirstWebApp.iml file and so could not load my project.

I checked out my project structure in the Explorer and everything except the iml file were there. I also looked at the Recycle Bin but I couldn't find it there aswell.

How can such a file just disapear?

How can I get my iml file back if its possible?

What do these iml files do?

I'm new in the Java World. If more information is needed just comment! :)

解决方案

*.iml files have nothing to do with your code/Java. It is a hidden file created by Intellij on the root folder of your project which contains your module information. This is the reason you should not version this kind of file, afterall other developers using a different IDE won't need them.

If you closed Intellij, I think there isn't a way to get the same file back, but on the other hand it is pretty simple to regenerate a new .iml file:

Gradle based project

Click the Sync Project with Gradle Files button (this one ) in the toolbar;

Maven based project

Go to File > Project Structures > Modules > Add (click the green + button).

Edit:

My previous answer were based on IntelliJ 14 and it seems some things have changed on the newer versions, as pointed by hBrent and BeC on the comments.

Using Intellij Community 2018.1 for this update:

Maven based project

The procedure remains the same, the only difference I saw is the Add icon isn't green anymore. One can also try removing the rootFolder/.idea/modules.xml and adding the modules afterwards to reset all information regarding the previous configurations.

Gradle based project

Should use "Refresh all Gradle projects" on the Gradle Tool Window (View > Tool Windows > Gradle), represented by the standard refresh icon.

最后

以上就是寒冷马里奥为你收集整理的idea中的iml文件_IntelliJ IDE | .iml文件丢失或删除的全部内容,希望文章能够帮你解决idea中的iml文件_IntelliJ IDE | .iml文件丢失或删除所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(45)

评论列表共有 0 条评论

立即
投稿
返回
顶部