Currently Being Moderated

How to manage IntelliJ IDEA projects under Version Control Systems

VERSION 6

Created on: Dec 13, 2009 10:41 PM by Serge Baranov - Last Modified:  Nov 26, 2013 5:46 PM by Serge Baranov

This document is out of date, please refer to the new version: http://intellij-support.jetbrains.com/entries/23393067.

 

Depending on the IntelliJ IDEA project format (.ipr file based or .idea directory based), you should put the following IntelliJ IDEA project files under the version control:


.ipr file based format

Share the project .ipr file and and all the .iml module files, don't share the .iws file as it stores user specific settings.

 

.idea directory based format

Share all the files under .idea directory in the project root except the workspace.xml and tasks.xml files which store user specific settings, also share all the .iml module files.

Average User Rating
(3 ratings)




Chris Herron Chris Herron  says:

I have a large multi-module Maven project that was imported to become an IntelliJ project. Cumulatively, there are a lot of libraries.

Under .idea/libraries there are many files of the pattern: "Maven_groupId_artifactId_version.xml"

Since these are all derived from what is already configured in (and inferred from) the pom files, can the .idea/libraries directory be omitted entirely for Maven based projects? 

Anton Makeev Anton Makeev  says in response to Chris Herron:

Hi, Chris,

They cannot be omitted.

It is very core subsystem, that stores files in the .idea/libraries directory, these files are necessary for IDEA

to open an existing project correctly. These files also contain user-defined paths for the libraries, such as paths to sources and javadoc.

Ross Gerbasi Ross Gerbasi  says:

Been working with IntelliJ and Flex projects in SVN, does it make sense that we should also ignore misc.xml from the .idea folder?

I seem to get conflicts on that often as everyone starts up the project.

 

-ross

Serge Baranov Serge Baranov  says in response to Ross Gerbasi:

No, misc.xml must be in the version control. What kind of conflicts do you get with it?

Ross Gerbasi Ross Gerbasi  says in response to Serge Baranov:

this line is being added whenever I open my project, other developers do not have this line in there file

 

<component name="IdProvider" IDEtalkID="6CD5B8E1EF16C99D654FFF49E5CF4062" />

 

I am guessing they are not using IDETalk... It does not happen often but I would think any user specific stuff would not be shared across subversion though....

 

-ross

Serge Baranov Serge Baranov  says in response to Ross Gerbasi:

Thanks for the details, I've submitted youtrack.jetbrains.net/issue/IDEA-54149. You can follow it for progress.

Ross Gerbasi Ross Gerbasi  says in response to Serge Baranov:

Also in this file, in another project I had this added at the bottom

 

inside the <component name="SvnBranchConfigurationManager"> tag

 

<option name="myConfigurationMap">
      <map>
        <entry key="$PROJECT_DIR$">
          <value>
            <SvnBranchConfiguration>

                  <option name="trunkUrl" value="svn://svn.server.com/PATH/to/module/root" />
            </SvnBranchConfiguration>

             ...

 

With a bunch of trunk URL's pointing at different module roots.

 

I think what I did was after the project was in version control I went to the changes panel and clicked refresh. Suddenly this was in my misc.xml file. Another developer got a conflict

when he attempted to update.

 

I am not sure if these are just ok for everyone to share, or if it was just a conflict between IDEtalk stuff and then this being added.

 

-ross

Serge Baranov Serge Baranov  says in response to Ross Gerbasi:

VCS branches configuration is OK to share.

Ross Gerbasi Ross Gerbasi  says in response to Serge Baranov:

Thanks. what does that IDE talk ID mean for now? should everyone  disable the plugin?

 

-ross

Serge Baranov Serge Baranov  says in response to Ross Gerbasi:

This FAQ is not the best place for the discussion, please either contact us by e-mail, or better move the discussion to the issue tracker (see the link I posted above). I don't know what it means, watch the tracker issue for progress.

Chris Herron Chris Herron  says in response to Serge Baranov:

Regarding the sharing of (or not sharing) VCS branches, see: http://youtrack.jetbrains.net/issue/IDEA-23653

David Cameron David Cameron  says:

Random changes to the *.iml files and files under IDEA seem to make this impractical at best. Worst offenders are line order changes in iml files and empty blocks appearing or disappearing. For example, I have this change sitting in my working copy right now in Project_Default.xml, and have no idea how or why it ended up there:

-      <option name="ignorableAnnotations">

-        <value />

-      </option>

Michael Greenspan Michael Greenspan  says:

Is there a way to move the locations of the .iml files? It seems that they need to be in the module's root directory, but not everyone on my team will be using intellij as their IDE, and I don't want to add noise in those directories. I want to put all of the intellij configuration into a single folder. Is that possible?

Serge Baranov Serge Baranov  says in response to Michael Greenspan:

Location of the module files can be specified when adding new modules, there is no automated way to change it later.

Michael Greenspan Michael Greenspan  says in response to Serge Baranov:

Ah ok I see now. I was selecting the option to create projects over existing sources. I had to create the project from SCRATCH to be able to specify where the iml files go. Thanks.

Anatoliy Kolesnick Anatoliy Kolesnick  says:

I am using WebStorm and it puts folllowing content to misc.xml:

     

    <?xml version="1.0" encoding="UTF-8"?>

      <project version="4"> 

          <component name="ProjectResources">   

              <default-html-doctype>jar:file:\C:\Program Files (x86)\JetBrains\WebStorm 5.0.4\lib\webide.jar!\resources\html5-schema\html5.rnc</default-html-doctype> 

          </component> 

          <component name="ProjectRootManager" version="2" />

      </project>

         

         

         

        I should put misc.xml under source control, but reference to WebStorm installation folder is too machine specific and may differ between users at least by WebStorm version or by OS (Mac/Linux) WebStorm is installed on.

        I tried to replace part of path with $APPLICATION_HOME_DIR$, but after reopening the project it was replaced back to full path.

         

        So I am curious, what to do in such a case?

        Serge Baranov Serge Baranov  says in response to Anatoliy Kolesnick:

        It looks like a bug, please report at http://youtrack.jetbrains.net/issues/IDEA and we'll try to address this problem.

        Daniele Segato Daniele Segato  says:

        I think this suggestion is wrong.

         

        I have a file
        .idea/dictionaries/mastro.xml

         

        in all my projects. "mastro" is my user name, doubt I should share that.

         

        Since I use gradle I have:
        .idea/gradle.xml:        <option name="gradleHome" value="$USER_HOME$/usr/gradle-1.6" />

         

        which, again, is my setting. I installed gradle in that location and I set up Intellij to know it's there.
        Shouldn't be placed in the VCS...

         

        I don't doubt there are many cases like these and this doc doesn't list them, so, to me, it's better to avoid sharing anything related to Intellij in the VCS until a proper list of files safe to be shared is given.

         

        I'm using an Android Studio project but I doubt it's different from Intellij in this matter.

        Is this a bug?
        Regards

        Serge Baranov Serge Baranov  says in response to Daniele Segato:

        See http://youtrack.jetbrains.com/issue/IDEA-55923 regarding gradle.xml. Sharing your dictionaries will not affect other developers, but you can exclude it from the VCS if you so desire.

        Daniele Segato Daniele Segato  says in response to Serge Baranov:

        The bug you link is closed as "WONT FIX" which makes no sense to me, even if I read the comments I completely disagree. How is the user supposed to know which files should be commited and which shouldn't?


        About dictionaries: I disagree, if another user has the same username as me (unlickely but possible, if for example I used "daniele" as username) we would stumb upon each other foots.

         

        And I think this documentation should point that out.

        Serge Baranov Serge Baranov  says in response to Daniele Segato:

        I've updated the documentation at http://intellij-support.jetbrains.com/entries/23393067 .

         

        This document is obsolete and will be removed.

        Richard Thomson Richard Thomson  says:
        I have noticed several files under the .idea directory constantly churning as I work on a GWT project:1)  I have a template under resources/src which I use to generate a class that has my application version number.  I added resources as a source directory because it's where I have my CSS.  I exclude resources/src since it contains the source template.  IJ keeps forgetting these settings and I have to keep re-marking resources/src as excluded.  Why does it keep changing this information?  I see it in the project file when I mark it manually, but at some later time IJ decides to delete my manual changes.  2) IJ keeps changing the files under .idea/libraries.  The symptoms are multiple identical XML lines added/removed specifying sources to libraries GXT, GWT, etc.  I can understand adding the line if I click "Attach sources" in the IDE, but why does IJ keep removing/adding these lines repeatedly?  Both of these behaviors are causing my .idea files to churn constantly in version control, and the first one actually loses a setting that I made manually and must make again when IJ loses it or my code fails to compile.  (The template is not a valid Java source file)
        Serge Baranov Serge Baranov  says in response to Richard Thomson:

        Manual changes will be discarded if you are using Maven and the pom.xml is reimported.

        Richard Thomson Richard Thomson  says in response to Serge Baranov:
        So you're saying that I need to mark the directory exclusion in the POM in order to get it to stick?
        Serge Baranov Serge Baranov  says in response to Richard Thomson:

        Yes, modifications should be done in pom.xml.

        Richard Thomson Richard Thomson  says in response to Serge Baranov:

        ok, I have this in my pom, which I thought excluded resources/src:

        <build>
          ...
          <resources>
            <resource>
              <directory>resources</directory>
              <excludes>
                <exclude>src/**</exclude>
              </excludes>
            </resource>
          </resources>
        

        But IJ doesn't recognize resources/src as excluded.

        I read through some POM documentation and I didn't see anything other than this in the pom for excluding directories or files.

        What am I missing?

        Sergey Evdokimov Sergey Evdokimov  says in response to Richard Thomson:

        Unfortunatelly changing of pom.xml will not help. May be you don't need to exclude resources/src from project, you need to exclude resources/src from compilation (Settings | Compiler | Excludes) ?

        Richard Thomson Richard Thomson  says in response to Sergey Evdokimov:

        Thanks, that did the trick.  Now I know that re-importing my POM is what causes the changes to occur.

         

        Now can someone explain to my why IJ always adds this non-existing directory to my project iml?

         

        <excludeFolder url="file://$MODULE_DIR$/target/generated-sources/groovy-stubs" />

         

        Our project doesn't use groovy and it isn't mentioned in our POM anywhere.

        Mohit Vora Mohit Vora  says:

        The IvyIDEA plugin adds a line for each resolved JAR (and there are 100s). With every resolve this file is opened for editing. Order and / or version number of the dependencies keep changing. Can this be fixed please?

        Serge Baranov Serge Baranov  says in response to Mohit Vora:

        This plug-in is not maintained by JetBrains, please contact the plug-in vendor for help.

        Richard Thomson Richard Thomson  says in response to Richard Thomson:
        I think I found the source of this due to some gmaven plugin stuff in the POM.  Now that I understand what is going on behind the scenes between the POM and IntelliJ I think I can figure out the rest of my unwanted churn.  Thanks for the help!  I love JetBrains!
        Jörg Schömer Jörg Schömer  says in response to Anton Makeev:

        Hi Anton,

        when changing the dependencies some files become obsolete, how do we get rid of these files.

        They are still under version control.