How to configure IntelliJ to use short package names on “Optimize imports” for a scala codebase?

In a scala project where we are using IntelliJ, we want to use multiple packages per file, so that we can reference them with the shorter syntax:

package com.dreamlines.dragonfly
package api
package domain
package harbours

import common.entities.EsHarbour
import common.utils.date.DLDateTime

Yet IntellJ wants to enforce the fully qualified package name and hence on optimizing the imports it changes the code to:

import com.dreamlines.dragonfly.common.entities.EsHarbour
import com.dreamlines.dragonfly.common.utils.date.DLDateTime

How do I configure the behavior of optimizing import?

Please sign in to leave a comment.