https://kotlinlang.org logo
Title
l

LastExceed

10/22/2019, 10:11 AM
how do i set up modules in IntelliJ ? I rightclicked the mainproject and added a module from there but the module has no source folder by default and when I create it manually it doesnt give me the presets for creating kotlin files ect (and when i create those manually as well i dont have any syntax highlighting, code completion ect)
e

eekboom

10/22/2019, 10:14 AM
Did you select “Kotlin” type when you added the module? Maybe even better: Take a step back and explain what you are trying to do. If I just want to quick start a simple Kotlin app for experimentation, I usually do “gradle init --type=kotlin-application”
l

LastExceed

10/22/2019, 10:15 AM
i selected Gradle -> Kotlin/JVM as the project type as i always do when creating a new project
i am working on something like a chat software (e.g. discord) where i have a server and a client which share some resources
so i want to create a root project which contains the shared resources and 2 modules (client and server)
i'd prefer not to use command line as i am a beginner and highly prefer using IntelliJ's UI
e

eekboom

10/22/2019, 10:19 AM
When you have a gradle project, IDEA will not help you to create a new module, AFAIK. Create a new directory for your new module, create a build.gradle(.kts) in that module, include the new module in your settings.xml and re-import into IDEA.
l

LastExceed

10/22/2019, 10:20 AM
it does

https://i.imgur.com/M7QFJ3l.png

it creates the folder and the build.grade file inside it
e

eekboom

10/22/2019, 10:23 AM
Well, live and learn.
Have you tried if re-importing the gradle project helps?
I meant that I consider myself quite knowledgeable in everything IDEA, but did not know that.
Did IDEA also change the settings.gradle?
l

LastExceed

10/22/2019, 10:25 AM
yes, it added a line
include 'server'
and no, reimporting doesnt help either
e

eekboom

10/22/2019, 10:42 AM
Ok, I just tried it: Strangely, IDEA briefly modifier the settings.gradle, but then removed the line again. I re-added it, re-imported and then got an error because IDEA added the version info to the plugin declaration in the new submodule: id ‘org.jetbrains.kotlin.jvm’ version ‘1.3.50’ That does not work of course, because the version is already set in the root project. I removed that version and re-imported and everything seems to work.
l

LastExceed

10/22/2019, 11:03 AM
i too had the problem with the version and aready figured out how to fix it, but unfortunately that doesnt fix the mising kotlin ide integration#
e

eekboom

10/22/2019, 1:55 PM
Hm, strange. And you are sure that you created the correct folder structure “server/src/main/kotlin”?
l

LastExceed

10/23/2019, 5:59 AM
i went to bed and the next morning it just worked without changing anything ¯\_(ツ)_/¯