is there some simple way to get all dependencies i...
# ktor
r
is there some simple way to get all dependencies in one implementation? coz everything is just so spread and I dont know what dependencies to download. like where is JacksonSerializer?
Copy code
implementation "io.ktor:ktor-client-json:$ktor_version"
    implementation "io.ktor:ktor-jackson:$ktor_version"
    implementation "io.ktor:ktor-client-jackson:$ktor_version"
    implementation "io.ktor:ktor-client:ktor-client-jackson:$ktor_version"
📝 1
1
d
Not directly. We don’t provide a library depending on all the artifacts. But you can create a library that just include all the libraries.
in the documentation (modulo bugs), there is information about the artifact
e
Nope.
implementation
dependencies are not transitive. Unfortunate the
kotlin-native
plugin doesn't support
api
dependencies.
You could ask about dependencies in #kotlin-native channel
r
no additional artifacts needed. but its not present in
Copy code
implementation "io.ktor:ktor-features:$ktor_version"
d
that’s for the server
what you asked was for the client, right?
I’m going to change that, to make it clearer since now it is a bit confusing
right now for the client is this
though I forgot to update to include the jackson part from 0.9.4
r
yeah, im asking for client. still I cant import CIO engine, i have:
Copy code
// ktor http client
    implementation "io.ktor:ktor-client-cio:$ktor_version"
    implementation "io.ktor:ktor-client-core:$ktor_version"
    implementation "io.ktor:ktor-client-gson:$ktor_version"
I can see the library, even file CIO in External libraries in IntelliJ idea but
Copy code
import io.ktor.client.engine.cio
doesnt work
cio shines red in import. It seams like it cant merge io.ktor.client.engine from core and from cio at the same time
d
I have updated the client JsonFeature section: https://ktor.io/clients/http-client/features/json-feature.html
Shouldn’t it be
import io.ktor.client.engine.cio.*
instead of
import io.ktor.client.engine.cio
?
which java version are you using? is that something related with >= java 10?
r
java 8
I’ve tried other engines and none is working. I can see them in External libs but cant import them
I can see HttpClientEngine interface from ktor-client-core and this one can be imported. It is from the same packege io.ktor.client.engine
e
Couldn't reproduce on openjdk and oraclejdk. Could you provide your
build.gradle
and request sample with imports?
r
e
Awesome. Thanks.
r
Thank You
e
Could you explain why you use
kotlin-platform-common
without platform specific modules?
CIO
and
Apache
engines is the
jvm
specific modules
Could you provide the use case to clarify the solution?
r
I want to use http client in common module of multiplatform project
for Android and iOS platform
e
Ok, you could use `HttpClient()`(without engine) in common module and in platform module add the platform specific dependency.
r
is there any engine which is platform independent?
e
Nope. Engine is fully platform specific part of the client.
Usually there is no difference between engines
r
is Jetty also jvm specific?
e
Yep.
Jetty
is jvm specific engine for http2.
r
so which one should I use for iOS platform?
e
Ios
engine.
Android
and
OkHttp
is for android and jvm.
r
I can see only these 3 jvm engines https://ktor.io/clients/http-client/engines.html
👀 1
1
📝 1
d
r
thanks, so now I just expect engine from android and iOS module and in platform module I import and add actual engine, right?
btw, is it the same with JsonSerializer? (GsonSerializer and GsonSerializer)
d
I would just use
HttpClient()
Just do not set the serializer and it will use the default
r
ok, thx
btw @Deactivated User and @e5l Thank you for helping me. You are just awesome 👍
simple smile 2
👍 2