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


#1

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)



#2

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.


#3

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.


#4

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