Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can / Should I add kotlinc.xml to my version control ignore file?

Somewhere in the process of setting up a Java project in IntelliJ IDEA (2017.1.2) a file in the .idea/ directory called kotlinc.xml showed up. I do nothing with Kotlin, but the file is there with contents:

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="KotlinCommonCompilerArguments">
    <option name="languageVersion" value="1.1" />
    <option name="apiVersion" value="1.1" />
  </component>
</project>

This seems some generic configuration, but I can imagine some project-specific (and not just my-local-IDEA-specific) configuration of Kotlin is stored there. So, in general, can this file be ignored when sharing the project under version control (e.g. Git), i.e., not committing it and publishing it somewhere online? Or should it be ignored?

like image 840
Erik Avatar asked May 16 '17 18:05

Erik


2 Answers

I have never submitted anything from .idea directory.

If you use modern build system like Gradle or Maven there is no need to submit such metafiles because IDEs like Intellij IDEA or Eclipse can successfully extract such metadata from dependencies / properties.

Mostly, IntelliJ will ask you to override existing properties in .idea folder.

After importing Gradle / Maven project IntelliJ creates its own .idea directory with configurations and properties.

I prefer to keep my project as clean as possible (sources, build (gradle, maven) files, CI, README). Fortunately, Java allows us to make portable sources / projects so we should not waste this chance :)

like image 183
Andrii Abramov Avatar answered Oct 06 '22 01:10

Andrii Abramov


You should not add this file to your version control ignore file. We have this file checked in, as it contained relevant JVM target information. This is in line with the official Jetbrains sharing recommendation, which states:

Here is what you need to share:

  • All the files under the .idea directory [...]

kotlinc.xml is not stated as an exception to this rule.

Additionally, the gitignore templates from github and gitignore.io do not list this file, so it should be checked in.

like image 35
guglhupf Avatar answered Oct 05 '22 23:10

guglhupf