also we cannot find a straight story on whether to...
# intellij
s
also we cannot find a straight story on whether to check in the IML files or not, we currently are checking them in however it's problematic because the user's home directory gets embedded into the class path of the iml file
m
Don’t check in iml files. Are you importing the project directly into IntelliJ by importing the build.gradle, or are you generating IDEA projects using the plugin for Gradle that generates IDEA projects? I’d Strongly recommend NOT using the Gradle plugin, and just directly importing the build.gradle file in IntelliJ.
s
Thanks for the reply, we'll give that a shot.. Should we check in the .idea directory at all?
also, are you referring to the IntelliJ IDE Gradle plugin (like disabling it) or not using kotlin-gradle-plugin in our build.gradle?
c
Definitely do not check in whole
.idea
directory, you could if you want check in some files from there which pertain to the project settings like code style. This is in the IntelliJ docs: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839-How-to-manage-projects-under-Version-Control-Systems They even link to an up-to-date example
.gitignore
file. Mike is referring to Gradle's own
idea
plugin.
💯 1
s
ok, yea the documentation is a little confusing on whether or not it's a good idea to check in the .iml files. I just deleted the .idea directory and reimported the project, everything looked mostly good at first, it recreated the .idea directory and way less files however the first time I changed a dependencies version the my unit tests again could not resolve code from the main module & it changed my project settings to use JVM 1.6 with Kotlin
m
Are you using Kotlin 1.3.20+ and have the new ‘kotlin.parallel.tasks=true’ setting enabled either in your project or in gradle.properties? I suspect so, and if so, that’s the problem. Had the same issue myself. https://youtrack.jetbrains.com/issue/KT-29564 If so, turn it off, and reimport your project. It should correctly detect 1.8 again.
c
Plus don't forget that you have to reimport project each time you change anything in gradle, like dependencies, task configuration, etc.
s
@Czar is there a way to automate the reimport?
c
Yes, in IntelliJ settings, in gradle section there is a check box to enable auto-import.
m
And if you don’t have auto-import on, it will tell you anytime the build.gradle, settings.gradle or gradle wrapper files change. It pops up a dialog with options to import project, or turn on auto-import.