IntelliJ files (.iml .ipr etc.) and Source Control

Hello again,

I am looking for a document, advice and/or good practice.

I have a team of people using IntelliJ and SVN.  When one of us fixes a bug in their IntelliJ project (e.g. add a missing dependency) I want the team to inherit that fix.  I want the team to be working on "the same" project.

However, we have been having a terrible time trying to share our IntelliJ files.  IntelliJ always seems to be altering the .iml and .ipri files every time a project is used.  We are constantly trying to decide if we should use the new version in source control, or keep our local version which is working at the moment.

How should a team of people use IntelliJ?  Is there a document that describes good practice?  What do other teams do?

I know we are not the first
Thanks
Peter

5 comments
Comment actions Permalink

Hello Peter,

The .ipr and .iml files are definitely supposed to be stored in version control.
If you have unexpected changes, please attach diffs and we'll see what we
can do to avoid them.

To avoid merge conflicts in project files, it also helps to use the new directory-based
project format introduced in IDEA 8.

Hello again,

I am looking for a document, advice and/or good practice.

I have a team of people using IntelliJ and SVN.  When one of us fixes
a bug in their IntelliJ project (e.g. add a missing dependency) I want
the team to inherit that fix.  I want the team to be working on "the
same" project.

However, we have been having a terrible time trying to share our
IntelliJ files.  IntelliJ always seems to be altering the .iml and
.ipri files every time a project is used.  We are constantly trying to
decide if we should use the new version in source control, or keep our
local version which is working at the moment.

How should a team of people use IntelliJ?  Is there a document that
describes good practice?  What do other teams do?

I know we are not the first
Thanks
Peter
---
Original message URL:
http://www.jetbrains.net/devnet/message/5245422#5245422

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

Completely agree, you must use the new .idea structure which totally avoids complex merges.


0
Comment actions Permalink

Hi,

FWIW, I recently switched to a .idea based project.  There are a couple of things to keep in mind before switching:

1- Don't use 8.1.3 because a regression causes the .svn directory inside the .idea directory to be blown away and cause a bunch of problems.  All your developers have to be on 8.1.4 EAP at the very least. (9920 or better)

2- When you setup the project, it by default ignores the workspace.xml file.  It does that for good reason.  If you add it to svn, then everyone's workspace will be shared and that's not a good thing.  IDEA has a few facilities to share some of the run targets like jboss etc... by simply clicking a share this with other check box in each settings window.  That creates new .xml files so that will be carried around without the need to share the workspace.

I find the .idea method to work incredibly well.  If we didn't have the 8.1.3 bugs to deal with, it would have been an incredibly smooth migration.  now that the whole team is on it, things move quick, changes happen quickly and not only that, but if a module changes, you don't have to reload the whole project;  you update and boom everything falls into place and you can keep working.

Good stuff.  Highly recommend it.  In fact I don't know why you'd use the 'old' way.

R

0
Comment actions Permalink

I am using starteam integration and intellij is putting work-related specific information in the .ipr file. Every time I schedule a file or directory to be added, this informatoin is stored in the project file. It has nothing to do with the project structure or settings, it's just work that I am doing that is being stored there. Intellij is constantly asking me if I want to reload the project because the .ipr file keeps changing.

Here is an example of an entry I would expect to see in a working directory rather than the project file:

<component name="StarteamVcsAdapter">
    <StarbasePersistencyNewFile>$PROJECT_DIR$/../some/directory/test/config/file.txt</StarbasePersistencyNewFile>
    <StarbasePersistencyNewFile>$PROJECT_DIR$/../some/directory/test/config/directory</StarbasePersistencyNewFile>
  </component>

0
Comment actions Permalink

Hi,

I have this problem in a project created with the newest IDEA that was available in early 2016. It uses the .idea directory format. Now I'm running 2016.2.5 with java 1.8.0_101 and it still occurs. Please note that our team has slightly different versions of IDEA and Java8 running, but still at most half a year of difference.

My project os a maven java project producing a .war file, and the .iml file looks like this:

<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" version="4">
  <component name="FacetManager">
    ...
  </component>
  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
    <output url="file://$MODULE_DIR$/target/classes" />
    <output-test url="file://$MODULE_DIR$/target/test-classes" />
    <content url="file://$MODULE_DIR$">
      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
      <excludeFolder url="file://$MODULE_DIR$/lib" />
      <excludeFolder url="file://$MODULE_DIR$/log" />
      <excludeFolder url="file://$MODULE_DIR$/node" />
      <excludeFolder url="file://$MODULE_DIR$/target" />
    </content>
    <orderEntry type="inheritedJdk" />
    <orderEntry type="sourceFolder" forTests="false" />
    <orderEntry type="library" name="Maven: org.springframework:spring-jdbc:4.2.4.RELEASE" level="project" />
    <orderEntry type="library" name="Maven: org.springframework:spring-orm:4.2.4.RELEASE" level="project" />
    <orderEntry type="library" name="Maven: org.springframework:spring-tx:4.2.4.RELEASE" level="project" />
    <orderEntry type="library" name="Maven: org.aspectj:aspectjrt:1.8.8" level="project" />
...
  </component>
</module>

The problem I am occasionally running into is that I get a diff for this file that reorganizes most of the maven-provided <orderEntry> elements in the file. It even happens even if no versions actually change (verified by sorting the list of entries).

In the .idea directory there is a .idea/artifacts/myproject_war_exploded.xml:

<component name="ArtifactManager">
  <artifact type="exploded-war" name="myproject:war exploded">
    <output-path>$PROJECT_DIR$/myproject/target/myproject-1.0-SNAPSHOT</output-path>
    <root id="root">
      <element id="directory" name="WEB-INF">
        <element id="directory" name="classes">
          <element id="module-output"5 name="myproject" />
        </element>
        <element id="directory" name="lib">
          <element id="library" level="project" name="Maven: org.springframework:spring-jdbc:4.2.4.RELEASE" />
          <element id="library" level="project" name="Maven: org.springframework:spring-orm:4.2.4.RELEASE" />
          <element id="library" level="project" name="Maven: org.springframework:spring-tx:4.2.4.RELEASE" />
          <element id="library" level="project" name="Maven: org.aspectj:aspectjrt:1.8.8" />
          ...
        </element>
      </element>
      <element id="directory" name="META-INF">
        <element id="file-copy" path="$PROJECT_DIR$/myproject/target/myproject-1.0-SNAPSHOT/META-INF/MANIFEST.MF" />
      </element>
      <element id="javaee-facet-resources" facet="myproject/web/Web" />
    </root>
  </artifact>
</component>

Is it perhaps so that IDEA honors the order of deps, but maven doesn't and gives them in some unpredictable order? If so, perhaps the maven deps could just be sorted alphabetically?

0

Please sign in to leave a comment.