https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
v

vivek anand

09/23/2023, 2:57 PM
I think the instruction to apply the serialization plugin in this tutorial is wrong. The correct one for
kts
should be
Copy code
kotlin("plugin.serialization").version("1.9.10").apply(false)
j

Javier

09/23/2023, 3:22 PM
If you set apply to false it is not applied. The tutorial is valid.
v

vivek anand

09/23/2023, 3:34 PM
I don't think that's what the apply method does the documentation is as below. I understand that
apply(false)
apply the plugin to the sub-projects and not just the current project. Anyway, the issue with the tutorial is that the gradle syntax is wrong, for
kts
the version and other parameters should be applied as chained method calls.
j

Javier

09/23/2023, 3:35 PM
both, version and apply, should be infix functions so it is a valid syntax
☝️ 1
☝🏾 1
If you set apply to false the plugin is not applied and it will not work in the current project, using apply false is commonly done in the root project in order to add the plugin with a specific version to the classpath
☝️ 2
☝🏾 1
but it will not be applied to root or any subproject.
☝️ 1
☝🏾 1
v

vivek anand

09/23/2023, 3:44 PM
I am not sure if
version
and
aplpy
are infix functions, they seem to be Java methods to me. Anyway using
version
as an infix method did not work for me, chaining it as above with
apply(false)
worked though. Maybe some version mismatch I guess 🤔
NVM I found the infix versions, but I get a gradle error tho
Copy code
Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find org.jetbrains.kotlin:kotlin-serialization-compiler-plugin-embeddable:1.8.21.
j

Javier

09/23/2023, 3:49 PM
I haven’t used the serialization embeddable plugin before
But looks like its first published version is 1.9.0, at least on maven central
Maybe previous versions exist in the bootstrap repository
v

vivek anand

09/23/2023, 3:56 PM
Hmm weird, I think what you said about the syntax in the tutorial being valid is correct. But using that in the
shared
module is giving me the above error, but using it in the root project works.
Which I think is what
apply false
also does but the tutorial says to apply the plugin to the gradle file in the `shared`module, but then I think
apply false
also have to be added, otherwise
kotlin("plugin.serialization") version "1.9.10"
should be added to the gradle file in the root project 🤔
j

Javier

09/23/2023, 4:00 PM
Are you sharing the same version between Kotlin and Kotlin Serialization?
3 Views