https://kotlinlang.org logo
Title
a

Andrew

06/26/2022, 4:45 PM
Possibly an IntelliJ question, is there a way to specify the root package name? I noticed if I have at least 1 class in the root and set the package to the name I want, then new files added there or sub directories automatically get the correct package name. Problem is if there are no classes in the root (only other sub-packages) then new files created in those don't get the correct package name and defaults to "package dirname" instead of "com.blah.modulename.dirname"
s

Starr

06/26/2022, 4:52 PM
perhaps a file at root containing only
package com.blah.modulename
?
a

Andrew

06/26/2022, 7:06 PM
I did do that which seems like a weird workaround, figured it would be able to use something like a line in the build.gradle
r

Rob Elliot

06/27/2022, 8:15 AM
In IntelliJ you can set the root package via the UI by going into Module Settings, selecting the source folder and editing it (ringed in red here):