# Multiplatform project with multiple common modules

**URL:** <https://discuss.kotlinlang.org/t/multiplatform-project-with-multiple-common-modules/8201>\
**Category:** Support\
**Created:** [June 19, 2018, 8:35am UTC](https://discuss.kotlinlang.org/t/multiplatform-project-with-multiple-common-modules/8201 "2018-06-19T08:35:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![fatjoe79](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/fatjoe79/32/4221_2.png) [@fatjoe79](https://discuss.kotlinlang.org/u/fatjoe79)\
**Post date:** [June 19, 2018, 8:35am UTC](https://discuss.kotlinlang.org/t/multiplatform-project-with-multiple-common-modules/8201/1 "2018-06-19T08:35:26Z")

</div>

I need help with getting a simple demo project compiling. The project consists of 2 layers of modules that depend on each other. Each layer consists of 3 modules: common, jvm, js.

For better illustration, I created a small dependency graph of my modules:

![modules](https://us1.discourse-cdn.com/flex019/uploads/kotlinlang/original/2X/7/7af842a54bffcf727635815ed93e55816e2e6994.png)

The whole project can be found on github, too:

> **[GitHub - fatjoem/multiplatformdemo: A minimal app demonstrating kotlin multi...](https://github.com/fatjoem/multiplatformdemo)**
>
> A minimal app demonstrating kotlin multi platform code sharing capabilities. - GitHub - fatjoem/multiplatformdemo: A minimal app demonstrating kotlin multi platform code sharing capabilities.

I try to build the project via gradle with the following command:

> cd multiplatformdemo/multiplatformdemo/  
> ./gradlew build

And gradle will return the following failure:

> e: /…/DemoCommon.kt: (3, 8): Unresolved reference: dependency  
> e: /…/DemoCommon.kt: (7, 21): Unresolved reference: DependencyCommon
> 
> FAILURE: Build failed with an exception.

Any help is much appreciated.

---

<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:** [June 19, 2018, 3:22pm UTC](https://discuss.kotlinlang.org/t/multiplatform-project-with-multiple-common-modules/8201/2 "2018-06-19T15:22:04Z")

</div>

You forgot to add

```auto
compile project(":dependency-js")

```

to your demo-js module 😉

---

<div class="post-metadata">

**Author:** ![fatjoe79](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/fatjoe79/32/4221_2.png) [@fatjoe79](https://discuss.kotlinlang.org/u/fatjoe79)\
**Post date:** [June 20, 2018, 7:25am UTC](https://discuss.kotlinlang.org/t/multiplatform-project-with-multiple-common-modules/8201/3 "2018-06-20T07:25:43Z")

</div>

Damn, thanks for pointing that out.

Unfortunately I didn’t do this particular mistake in my actual bigger project, in which it still does not compile. I will need time to compare the projects. Thanks so far!

---

<div class="post-metadata">

**Author:** ![fatjoe79](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/fatjoe79/32/4221_2.png) [@fatjoe79](https://discuss.kotlinlang.org/u/fatjoe79)\
**Post date:** [June 25, 2018, 11:40am UTC](https://discuss.kotlinlang.org/t/multiplatform-project-with-multiple-common-modules/8201/4 "2018-06-25T11:40:13Z")

</div>

I now added the kotlin file `DemoJs.kt` within the js platform module **demo-js**. As far as I can tell, it is correctly compiled into the `demo-js.js` output. My problem is that this output is not including the kotlin code from the **dependency-common** module.

How am I supposed to build the **demo-js** module, such that its output does not only include the compilation of its own kotlin code, but also the compilation of the kotlin code within **dependency-common** module?

---

<div class="post-metadata">

**Author:** ![fatjoe79](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/fatjoe79/32/4221_2.png) [@fatjoe79](https://discuss.kotlinlang.org/u/fatjoe79)\
**Post date:** [June 25, 2018, 12:18pm UTC](https://discuss.kotlinlang.org/t/multiplatform-project-with-multiple-common-modules/8201/5 "2018-06-25T12:18:52Z")

</div>

I am starting to assume that I will need to handle this within my gradle script myself (copy the output of the dependency module). Is there any better way?
