Is there a way to make IntelliJ IDEA *not* put Sca

2019-07-30 12:01发布

问题:

In Java, you have to put source files in the directory structure corresponding to their package. foo.bar.Baz has to live in foo/bar/Baz.java.

In Scala, that requirement is relaxed. If all your classes in a particular project are in package foo.bar, you might just want them to live in the root source directory.

But IDEA flags this as an error, and forces me to put Scala classes in their Java-style directory when, for example, I copy or move classes. Is there a way to turn off this behavior?

回答1:

Go Settings -> Scala -> Other settings -> Resolve to all classes, even in wrong directories.