https://kotlinlang.org logo
h

hmole

08/13/2018, 2:31 PM
How to properly declare a dependency on pure(no platform modules)
common-module1
jar in another
common-module2
? So far i'm getting NoClassDefFound in my 'common-module2-jvm', but IDE doesn't highlight imports as red and allows to navigate to them(
common-module1
).
r

russhwolf

08/13/2018, 4:04 PM
common-module1
still needs platform modules even if they have no code.
1
h

hmole

08/14/2018, 1:45 PM
How would that help? Do I need to import appropriate modules for each platform? So 'implementation "myLibrary"' in each platform module?
r

russhwolf

08/14/2018, 1:54 PM
Yeah. so
common-module1-jvm
has an
expectedBy common-module1
and then
common-module2-jvm
has both
expectedBy common-module2
and
implementation common-module1-jvm
h

hmole

08/14/2018, 2:07 PM
Sound's like oversight on Jetbrains part. Creating empty modules instead of just importing in once through common module.
r

russhwolf

08/14/2018, 2:16 PM
The common module doesn’t know to build a Jar. The jvm module is there so it knows that’s what you want to do. Though someone from Jetbrains can speak better than I can to the design decisions around that.
h

hmole

08/14/2018, 2:29 PM
So ho can my
common-module2
know about classes that are in 'common-modle1', if only my
common-module2-jvm
imports it?
r

russhwolf

08/14/2018, 2:30 PM
common-module2
should also have a dependency on
common-module1
.
h

hmole

08/14/2018, 2:31 PM
But you just said common-modules don't know how to build a jar. What should I depend on then?
r

russhwolf

08/14/2018, 2:34 PM
You end up with a sort of doubled-up dependency tree. So
common-module2-jvm
depends on both
common-module1-jvm
and
common-module2
, and both of those have a dependency on
common-module1