33

I'm working with Maven pom files, and I don't wish to source control iml files. When I open a project, IntelliJ seems to add some of the iml files it creates to the SVN source control. How can I prevent this?

I have "*.iml" in an "svn:ignore" property on the repository root, but it doesn't seem to prevent IntelliJ from adding the imls.

ripper234
  • 222,824
  • 274
  • 634
  • 905
  • 4
    It seems there is no solution or workaround for this problem. It really annoys me so I created an issue for JetBrains. http://youtrack.jetbrains.net/issue/IDEA-58169 – Jesse Webb Aug 31 '10 at 14:28
  • Thanks @Gweebz, upvoted on Youtrack. – ripper234 Sep 02 '10 at 05:29
  • 1
    Why do you want to avoid version controlling the .iml files (and probably, the .idea/.ipr project definition)? Is the reason is to avoid differences in absolute paths between various workstations? Is so, you should use Path Variables: http://www.jetbrains.com/idea/webhelp/paths-and-path-variables.html – retronym Sep 18 '10 at 11:11
  • If you don't ignore the files the problem won't go away. It will only be slightly different: IntelliJ will then delete and recreate the files on a regular basis resulting in `svn rm` and `svn add` messages popping up. – Martin Jun 28 '11 at 07:18
  • 1
    @retronym I stumbled onto this question, and though I don't know the OP's reason for wanting prevent IntelliJ from creating IML files, I know my reason. If I am working on a Grails project in NetBeans or Eclipse I can make changes in one IDE, close that IDE, then re-open the project in the other IDE and all is well. Not true when using IntelliJ. If I make edits in IntelliJ then NetBeans then go back to IntelliJ, IntelliJ freaks out and messes my files up. Took me like 2 hours to get it all sorted out the first time it happened to me. – ubiquibacon Nov 15 '11 at 09:51
  • 1
    At least two reasons for not version controlling the .iml's might be http://youtrack.jetbrains.net/issue/IDEA-64312 and http://youtrack.jetbrains.net/issue/IDEA-79280. – Raman Jan 12 '12 at 00:52

7 Answers7

34

In case somebody else stumbles onto this issue, the best luck I've had is
Settings > Version Control > Ignored Files
Add "Ignore all Files Matching"s for:
*.idea
*.iml

Not sure which version of IDEA rolled out this functionality, and this question is somewhat old, so it may be moot. Just hope it helps somebody else out who landed here from Google as I did.

jerwilkins
  • 1
  • 2
  • 3
  • It's available since version 13 ultimate. – Pavel Vlasov Nov 11 '14 at 08:37
  • Do you still have to do this? I am working on an android project with mac and pc users and we would like to know which files to ignore for both... – Micro Nov 26 '15 at 04:59
  • 1
    this setting doesn't work in my project =( I've just updated to 2016.4, deleted .iml files from git using "git rm" from terminal, added those to .gitignore, commited, and idea still manages to add those to git automatically. Nice feature, I'm pissed off >=((( – Askar Kalykov Feb 11 '17 at 15:30
9

The latest version of IntelliJ Community prompts you for the iml file additions separately. If you check the box to avoid being warned in future and choose "no" the first time you are prompted, it will not schedule any further IML files for addition to subversion.

JellyHead
  • 201
  • 2
  • 6
  • 2
    This does not work for me. In the newest version of IntelliJ (9.0.3) there is no checkbox to avoid being asked in the future. In my multi-module project (20+ modules) I am asked 20+ times for ever .iml file wether I would like to un-ignore it or not. – Jesse Webb Aug 30 '10 at 21:24
  • 1
    Works for me in 12.1.4 – Shanimal Jul 16 '13 at 17:57
  • 2
    I dislike the way that the checkbox doesn't indicate whether it's just IML files that will be ignored in future. It made me hesitant to check it until I read this answer. – Duncan Jones Apr 16 '14 at 08:40
3

Elaborating on Colin Hebert answer. Yes, it is possible to move the iml file to another directory when importing from Maven. And this seem to be the only way to prevent this problem.

Here the settings to use in import:

enter image description here

Since all important informations are keep in Maven itself it only takes a little time to reimport an existing modules. The gain truly is worth it.

Martin
  • 11,577
  • 16
  • 80
  • 110
2

If you want to disable checking in *.iml files across all projects, on the Mac OS X 10.8.x you can go to IntelliJ -> Preferences (Command-,) -> Version Control -> Ignore Files and set it up there. This is better if you are like me who works on many projects and frequently need to create/import new projects, I don't want to have to setup this pref on every individual project.

Vijay Kumar
  • 2,439
  • 2
  • 32
  • 51
2

You can also choose to not have your .iml file in a versionned directory.

When you create the module, you can select the module file location. alt text

Here my iml file will be in /ModuleName.iml but the content will by in /myRoot/

Colin Hebert
  • 91,525
  • 15
  • 160
  • 151
  • Does that work two options further down with “Maven Module”? And more importantly: Will it work if click on “Import existing Module” on the previous screen? Because that is the problem of the OP: IntelliJ with existing maven modules. – Martin Jun 28 '11 at 08:21
1

What worked for me, on my Intellij 2019 (2019.2.4 is my version) is: enter image description here

amer
  • 1,528
  • 1
  • 14
  • 22
-1

Configure IntelliJ to not add files automatically to subversion.

In IntelliJ 6, this configuration is on Settings > Version Control > General Settings:


File Creation/Deletion

When files are created with IDEA:

[x] Show options before adding to version control

b.roth
  • 9,421
  • 8
  • 37
  • 50
  • 1
    But I do want java files to be added automatically, just not iml files. – ripper234 May 25 '10 at 11:52
  • @ripper234, ok, but note that with the configuration above you will get a confirmation window every time a file is about to be added. You can approve the addition for java files and reject it for iml files. – b.roth May 25 '10 at 12:05
  • I don't want a confirmation window :) – ripper234 May 25 '10 at 12:15
  • 1
    That would make it worse: We **don't** what the .iml files in the repository. We **don't** even want to be asked. So this option gives us the **total opposite** of what we want. – Martin Jun 28 '11 at 08:25