Merges on IntelliJ IDEA .IPR and .IWS files

前端 未结 4 1090

We keep our IntelliJ .IPR and .IWS files in our source control, but they keep getting modified by IntelliJ just by opening them, even without any work being done on the proj

4条回答
  •  被撕碎了的回忆
    2020-12-14 02:06

    Without knowing exactly what is being changed, this is a little difficult to answer confidently, but I would say:

    • IWS files contain information describing how a developer's IDE is arranged for this project (including such things as recent change history, the current state of each editor window, which dockable windows are visible and which have been collapsed). Given that each developer should be allowed to arrange their workspace however they like, these should not be in source control.

    • IPR files describe the structure of the project code - by this I mean things like which modules are part of the project, which build.xml files to use, where to find libraries to compile your code etc. This can be in source control, but if you allow these settings to vary from one developer's copy of the project to the next, you'll be in for a rough ride.

    If you have a libraryTable component inside your IPR file:

    Almost certainly what is happening is that each developer is keeping shared libraries (JARs) - required to build their code - on their local machine in different places; when they commit changes, the location of their libraries is being written to the IPR file. If you were to do this, when I updated the project, my copy of the IPR and yours would conflict on the locations of these JARs.

    We get around this problem by locating JAR files in a shared location (such as a mapped network drive) and then ensuring that every developer downloads these files to the same place (a lib subfolder under the project root works well). The downside is that you end up with multiple copies of the same JAR across projects (each project will reference its own lib folder), but on the upside, as every developer is using the same project structure, updating IPRs should work a lot better.

    Otherwise:

    Have a look to see what IntelliJ is trying to merge (when you update, you should be given the option to manually merge the files or view differences, otherwise use your favourite diff tool). If you could update your question with a bit more info about what your merge conflicts look like, it might make it easier to see where the wheels are coming off.

提交回复
热议问题