Get misc.xml from VCS, but do not track it by default
What is the best practice for handling misc.xml with remote vcs? The file contains some custom configuration that needs to be cloned with the rest of the project. When a user goes to run our code however, they generally end up changing the jdk version (and hence misc.xml). This causes accidental commits of the file as well as "uncommitted change" headaches when changing branches.
The solutions that I can think of are all problematic for one reason or another.
> add it to gitignore :: the file is already in the repo, so this has no effect
> run git update-index --assume-unchanged misc.xml :: this only fixes the issue locally, each user would need to run it
> add a template misc.xml and copy it on build :: it needs to happen when the project is opened in intellij, not built
The ideal solution for me would be something like a '.idea/template/misc.xml' that Intellij copies on project-open to '.idea/misc.xml' if it does not already exist. With misc-template.xml being tracked via vcs, and misc.xml being ignored.
If there is no silver bullet, is there an issue for it in the tracker?
https://youtrack.jetbrains.com/issue/IDEA-90785 seems close, and some other dupes of 90785 seem closer, but none seem to directly address this issue.
Please sign in to leave a comment.
misc.xml does not contain a path to JDK, only the target JDK version and its name in the settings. And it actually seems to be the right thing to have it the same way for all people working on the project.
The user just needs to configure a JDK of his choice under the name defined by the project config (misc.xml) via Project Structure. He will need to do it anyway, as the local path to JDK is not known.
So looks like misc.xml should be just versioned, and should not be changed locally.
> is there an issue for it in the tracker?
https://youtrack.jetbrains.com/issue/IDEA-90785
> git update-index --assume-unchanged misc.xml
BTW, that is the wrong option to use. --skip-worktree serves the purpose. See https://git-scm.com/docs/git-update-index#_skip_worktree_bit
I think it is quite strange to force the user to use a specific name for the JDK. Consider that you might contribute to multiple projects which all require JDK 11 but they use different names in the JDK configuration. With your approach, you would have to add the same JDK multiple times with different names into your IDEA configuration. Also note that many projects are using other build tools like Gradle, which will make multiple options in the file redundant anyway. Beside that, some plugins are also adding certain options to the file, so as long as you are not also forcing each individual on a project to use the same IntelliJ plugins, putting the
misc.xmlinto the VCS is not a good option.