# 'Standalone' common library

**URL:** <https://discuss.kotlinlang.org/t/standalone-common-library/14839>\
**Category:** Multiplatform\
**Created:** [October 30, 2019, 8:59pm UTC](https://discuss.kotlinlang.org/t/standalone-common-library/14839 "2019-10-30T20:59:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Naliwe](https://avatars.discourse-cdn.com/v4/letter/n/a587f6/32.png) [@Naliwe](https://discuss.kotlinlang.org/u/Naliwe)\
**Post date:** [October 30, 2019, 8:59pm UTC](https://discuss.kotlinlang.org/t/standalone-common-library/14839/1 "2019-10-30T20:59:18Z")

</div>

Hello o/

I wanted to start a new multi-platform project which will include, _at first_, a Ktor server and a JS webapp.  
Most of the code can be in the common module, since the specifics will probably only be database engine, testing framework, ui-related classes and such.  
For now, I only know of two actual modules: JVM (Or Native, not sure yet) and JS. But then I started to wonder: what if someone wants to create an iOS or Android version ?  
My problem is, I don’t really want to put all that in one single repository. The ideal case would be to be able to define my common module _as standalone_, publish it on Bintray/whatever, and let people reference it as an `expectedBy()` dependency so that they can benefit from the common code and only focus on their module, in whatever repo they want, without the need to give them access to my code or have them pull a whole bunch of seemingly unrelated stuff (i.e why would the Android app dev need to know about / have access to the Webapp implementation?)

I’ve been able to create a ‘standalone’ common project, which builds, but IntelliJ’s linter is not happy with my `expect` declarations not having any `actual` counterparts. Since my gradle build doesn’t know anything about the modules hosted in some other repo.

So the question is: is this possible? Am I simply doing something wrong, or is it plain impossible?

NB: I understand the concept of mpp when it comes to a project the team knows which actual platform-specific modules it wants to implement. Even for multi-platform libraries. Kotlin MPP works really well for that. My question is really how to benefit from Kotlin common, and share this common module so _other_, unrelated people, can create their own implementation without managing the rest?

This is what I get in IntelliJ for my common module:

 ![image](https://us1.discourse-cdn.com/flex019/uploads/kotlinlang/original/2X/e/e38173c9970c0ae4c1a11988960d37a166ef9528.png)

Build is fine, but the linter, not so much ~

---

<div class="post-metadata">

**Author:** ![Wasabi375](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/wasabi375/32/4741_2.png) [@Wasabi375](https://discuss.kotlinlang.org/u/Wasabi375)\
**Post date:** [October 30, 2019, 9:59pm UTC](https://discuss.kotlinlang.org/t/standalone-common-library/14839/2 "2019-10-30T21:59:45Z")

</div>

> [@Naliwe](#):
>
> I’ve been able to create a ‘standalone’ common project, which builds, but IntelliJ’s linter is not happy with my `expect` declarations not having any `actual` counterparts. Since my gradle build doesn’t know anything about the modules hosted in some other repo.
> 
> So the question is: is this possible? Am I simply doing something wrong, or is it plain impossible?

Publishing a common module and implement the `actual` parts in another project is impossible, for now. Kotlin mulitplatform is still in early development and only released in an alpha stage right now. I am pretty sure this will be a feature before it’s final release, but it’s not possible right now.

The linter warning is kinda right. Although the build does not fail (in gradle) it does not create any useable output, mabye it should fail in gradle as well. The fact is, for mpp to work you need at least on module with `actual` implementations.

---

<div class="post-metadata">

**Author:** ![Naliwe](https://avatars.discourse-cdn.com/v4/letter/n/a587f6/32.png) [@Naliwe](https://discuss.kotlinlang.org/u/Naliwe)\
**Post date:** [October 30, 2019, 10:06pm UTC](https://discuss.kotlinlang.org/t/standalone-common-library/14839/3 "2019-10-30T22:06:20Z")

</div>

Alright yeah, that is what I suspected.

I really hope that’s on the roadmap! I find Kotlin common or more generally MPP fantastic, but that’s the last roadblock I can think of.

Thanks for confirming it!

---

<div class="post-metadata">

**Author:** ![Alexey.Belkov](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/alexey.belkov/32/5215_2.png) [@Alexey.Belkov](https://discuss.kotlinlang.org/u/Alexey.Belkov)\
**Post date:** [November 7, 2019, 8:08am UTC](https://discuss.kotlinlang.org/t/standalone-common-library/14839/4 "2019-11-07T08:08:55Z")

</div>

Yes, it’s a known limitation, we’re considering fixing it at some point. You can vote/follow [https://youtrack.jetbrains.com/issue/KT-30088](https://youtrack.jetbrains.com/issue/KT-30088) for updates.
