https://kotlinlang.org logo
#ktor
Title
# ktor
s

smallufo

02/15/2021, 7:37 PM
Hi , is there something wrong with
ktor-client-serialization
(1.5.1) to
kotlinx-serialization-json
dependency ? I tried
Copy code
<dependency>
    <groupId>io.ktor</groupId>
    <artifactId>ktor-client-serialization</artifactId>
    <version>${ktor_version}</version>
</dependency>
but IntelliJ & maven always complains
Cannot resolve org.jetbrains.kotlinx:kotlinx-serialization-json:1.0.1
command line mvn complains :
Copy code
Caused by: org.eclipse.aether.resolution.DependencyResolutionException: Could not find artifact org.jetbrains.kotlinx:kotlinx-serialization-json:jar:1.0.1 in central (<https://repo.maven.apache.org/maven2>)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies (DefaultRepositorySystem.java:352)
    at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve (DefaultProjectDependenciesResolver.java:202)
And in maven center https://repo.maven.apache.org/maven2/org/jetbrains/kotlinx/kotlinx-serialization-json/1.0.1/ There is no jar file . That’s why maven complains it cannot find JAR file. KSJ is packaging in POM , not JAR https://repo.maven.apache.org/maven2/org/jetbrains/kotlinx/kotlinx-serialization-json/1.0.1/kotlinx-serialization-json-1.0.1.pom
Copy code
<packaging>pom</packaging>
Is it OK to import it like this ? https://repo1.maven.org/maven2/io/ktor/ktor-client-serialization/1.5.1/ktor-client-serialization-1.5.1.pom
Copy code
<dependency>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-serialization-json</artifactId>
<version>1.0.1</version>
<scope>compile</scope>
</dependency>
Sorry not sure about this. but it seems not working. Is it maven center’s problem ?
j

Jakub Gwóźdź

02/16/2021, 7:19 AM
Not sure if that's the same problem, but try to set dependency on
ktor-client-serialization-jvm
, not
ktor-client-serialization
s

smallufo

02/16/2021, 7:36 AM
wow , it works ! thanks. It seems ktor’s document should fix it
j

Jakub Gwóźdź

02/16/2021, 9:24 AM
Yeah. Would be great if that'd be the only problem with ktor's documentation 😕
😅 2
4 Views