# Extensions not working in multi-module gradle build but works in Idea

**URL:** <https://discuss.kotlinlang.org/t/extensions-not-working-in-multi-module-gradle-build-but-works-in-idea/8001>\
**Category:** Support\
**Created:** [June 3, 2018, 10:07am UTC](https://discuss.kotlinlang.org/t/extensions-not-working-in-multi-module-gradle-build-but-works-in-idea/8001 "2018-06-03T10:07:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![luistrigueiros](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/luistrigueiros/32/2161_2.png) [@luistrigueiros](https://discuss.kotlinlang.org/u/luistrigueiros)\
**Post date:** [June 3, 2018, 10:07am UTC](https://discuss.kotlinlang.org/t/extensions-not-working-in-multi-module-gradle-build-but-works-in-idea/8001/1 "2018-06-03T10:07:35Z")

</div>

Hi,

I believe to have found one issue with the the compiler & gradle build of extension between different sub-modules in a Gradle multi module build and the what happens on the idea.  
It works ok, as it build and compiles with no problems in idea but when compiling it on the command line with gradle the client module/project is not able to see the typealias and extensions declared in a project dependency module.

My declaring module has the following declarations:

* * *

import io.vertx.core.buffer.Buffer  
import io.vertx.core.eventbus.Message  
import io.vertx.ext.web.client.HttpRequest  
import io.vertx.ext.web.client.HttpResponse

typealias JsonMessage = Message

fun JsonMessage.handleSafely(block: (JsonMessage) → Unit) {  
try {  
block(this)  
} catch (t: Throwable) {  
this.fail(-1, t.message)  
}  
}

fun JsonMessage.onSuccess(response: HttpResponse) {  
response.bodyAsString(“ISO-8859-1”).also { this.reply(it) }  
}

fun JsonMessage.onError(t: Throwable) = this.fail(1, t.message)

* * *

---

<div class="post-metadata">

**Author:** ![pdvrieze](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/pdvrieze/32/1882_2.png) [@pdvrieze](https://discuss.kotlinlang.org/u/pdvrieze)\
**Post date:** [June 5, 2018, 9:19am UTC](https://discuss.kotlinlang.org/t/extensions-not-working-in-multi-module-gradle-build-but-works-in-idea/8001/2 "2018-06-05T09:19:29Z")

</div>

Are you using gradle to do the idea build? Newer gradle versions don’t make all library dependencies transitive. An implementation dependency is not added to the compilation classpath of a user of that library. Intellij (at least when editing) doesn’t make such a distinction yet between compile time and run time.

---

<div class="post-metadata">

**Author:** ![luistrigueiros](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/luistrigueiros/32/2161_2.png) [@luistrigueiros](https://discuss.kotlinlang.org/u/luistrigueiros)\
**Post date:** [June 5, 2018, 12:23pm UTC](https://discuss.kotlinlang.org/t/extensions-not-working-in-multi-module-gradle-build-but-works-in-idea/8001/3 "2018-06-05T12:23:49Z")

</div>

When compiling in idea I I don’t think it is using gradle and this works.  
When compiling in the command line it does not work, I have one multi project build and the extension declared in a parent module used downstream by other modules having declared to have a project type dependency on the shared parent module.

---

<div class="post-metadata">

**Author:** ![luistrigueiros](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/luistrigueiros/32/2161_2.png) [@luistrigueiros](https://discuss.kotlinlang.org/u/luistrigueiros)\
**Post date:** [June 5, 2018, 9:02pm UTC](https://discuss.kotlinlang.org/t/extensions-not-working-in-multi-module-gradle-build-but-works-in-idea/8001/4 "2018-06-05T21:02:03Z")

</div>

Thank @pdvrieze I found the source of the problem in my build.  
Using the spring boot dependency management and maven BOM imports.
