eirikb
08/29/2022, 1:20 PMval ktorVersion = "2.0.3"
implementation("io.ktor:ktor-client:$ktorVersion")
implementation("io.ktor:ktor-client-core:$ktorVersion")
implementation("io.ktor:ktor-client-apache:$ktorVersion")
implementation("io.ktor:ktor-client-json:$ktorVersion")
implementation("io.ktor:ktor-client-jackson:$ktorVersion")
implementation("io.ktor:ktor-client-logging-jvm:$ktorVersion")
implementation("io.ktor:ktor-client-auth:$ktorVersion")
implementation("io.ktor:ktor-client-websockets:$ktorVersion")
implementation("io.ktor:ktor-client-okhttp:$ktorVersion")
implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion")
implementation("io.ktor:ktor-serialization-jackson:$ktorVersion")
In another lib, LibB we include this lib.
implementation("ourgroup:ourapp:version")
When compiling LibB we get this error:
Cannot access class 'io.ktor.client.statement.HttpResponse'. Check your module classpath for missing or conflicting dependenciesWe don't reference anything from ktor directly in LibB
Aleksei Tirman [JB]
08/30/2022, 6:27 AMeirikb
08/30/2022, 7:13 AMAleksei Tirman [JB]
08/30/2022, 7:24 AMeirikb
08/30/2022, 7:28 AMeirikb
08/30/2022, 11:51 AMsuspend fun save() = client.use {
<http://it.post|it.post>("")
}
eirikb
08/30/2022, 11:55 AMAleksei Tirman [JB]
08/30/2022, 12:37 PMHttpResponse
type for the save
function the problem disappears?eirikb
08/30/2022, 12:50 PMsuspend fun save() = <http://client.post|client.post>("")
. This will return HttpResonse
.
Since this is returned to LibB, LibB needs to know about that class.
I would expect it to know about it though LibA, but it does not.
It was probably not intentional to expose HttpResponse
from LibA in the first placeeirikb
08/30/2022, 12:54 PMUnit
Aleksei Tirman [JB]
08/30/2022, 1:20 PMHttpResponse
type to the LibB (api("io.ktor:ktor-client-core:$ktorVersion")
) or return void from the save
function as you wrote.eirikb
08/30/2022, 1:23 PMeirikb
08/30/2022, 1:24 PM<http://it.post|it.post><Unit>
, but it should be <http://it.post|it.post>().body<Unit>
now I think. And thus it was never cast to Unit
eirikb
08/30/2022, 1:34 PM