Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it mandatory to save *.iml files in Version control?

I have now switched to Android Studio and saving my projects in Git with Source Tree. Whenever I add or remove any library from my module, its .iml file also changes. It really doesn't matter if I commit the *.iml because they get auto-generated in others Android Studio. However, here it says you should store *.iml . My question is, do we really need to share our *.iml with others? If yes, why?

like image 687
Prachi Avatar asked Aug 26 '14 11:08

Prachi


People also ask

What is .IML file in Git?

An IML file is a module settings file created by IntelliJ IDEA, an Integrated Development Environment (IDE) used to develop Java applications. It stores information about a development module, which is a Java, Plugin, Android, or Maven component of a Java application.

How are IML files generated?

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.

How do I open an .IML file?

iml files, you need appropriate software. Preferably, it would help if you used IDE. However, if not possible, you can open the files using any text editor like notepad on Windows, TextEdit on Mac, and Atom on multiple platforms.


2 Answers

General best practice is to:

  • make projects as IDE-agnostic as possible,
  • do not commit generated files.

So the answer is: it's better to make such files ignored for VCS.

like image 175
Marcin Szawurski Avatar answered Oct 12 '22 12:10

Marcin Szawurski


Yes, .iml Files are suitable for version control (see this comment)

It is also true to make projects as IDE-agnostic as possible, however, sharing .iml files does not break anything for people developing with another IDE. For them, they are just a bunch of relatively small files that don't concern them.

A good practice for teams using different IDEs simultaneously is to store each IDE's project files in the VCS, only excluding those which contain paths, environment variables etc. specific to a single developers environment. This way, anyone using one of the supported IDEs can enjoy the benefits of a proper, shared setup, like for example:

  • sharing build configurations
  • sharing dependencies
  • configurations for automatic code quality checks

There are more use cases, depending on the specific IDEs in play. Edit: For IntelliJ, also see this FAQ

like image 30
cygnus Avatar answered Oct 12 '22 12:10

cygnus