3

I have a simple Kotlin project in IntelliJ with two modules defined as sub-folders under the project root folder. Everything seems to be set up correctly in build settings, each module has its own folder marked as a source directory.

I can run main functions in both modules so IntelliJ is finding everything OK.

What I cannot do is reference a public class in one module in the other. I've tried every form of import statement I can think of, but the compiler always flags the class in module1 as an unresolved reference in module2.

Chuck Stephanski
  • 389
  • 5
  • 11
  • Does [this answer](https://stackoverflow.com/a/38878290/104891) help? – CrazyCoder Dec 06 '18 at 22:36
  • I don't think that helps. I'm not building w/ gradle, just IntelliJ's own tools. – Chuck Stephanski Dec 06 '18 at 23:00
  • Then you need to define the dependencies between the modules, see https://www.jetbrains.com/help/idea/creating-and-managing-modules.html#working-with-module-dependencies. – CrazyCoder Dec 07 '18 at 00:10
  • 1
    *Whew* that was tricky. IntelliJ doesn't work quite the way the docs say, there's no "File | Convert Module Groups to Qualified Names" option. But the other bits were helpful. If you create a module group, flatten it, then define your dependencies, it all works. Thanks for the pointers! – Chuck Stephanski Dec 07 '18 at 02:13

0 Answers0