Following the Kotlin Wrappers documentation I find...
# javascript
e
Following the Kotlin Wrappers documentation I find myself with this code
Copy code
getByName("jsMain") {
  dependencies {
    implementation(enforcedPlatform("org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:1.0.0-pre.605"))
    implementation("org.jetbrains.kotlin-wrappers:kotlin-js")
    implementation("org.jetbrains.kotlin-wrappers:kotlin-node")
  }
}
It loads the typings correctly. However when I go to publish to my local Maven repository, using
publishToMavenLocal
I get:
Copy code
Execution failed for task ':zproto:generateMetadataFileForJsPublication'.
> Invalid publication 'js':
    - Variant 'jsRuntimeElements-published' contains a dependency on enforced platform 'org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom'
  In general publishing dependencies to enforced platforms is a mistake: enforced platforms shouldn't be used for published components because they behave like forced dependencies and leak to consumers. This can result in hard to diagnose dependency resolution errors. If you did this intentionally you can disable this check by adding 'enforced-platform' to the suppressed validations of the :zproto:generateMetadataFileForJsPublication task. For more on suppressing validations, please refer to <https://docs.gradle.org/8.2.1/userguide/publishing_setup.html#sec:suppressing_validation_errors> in the Gradle documentation.
Should I just suppress this error? Or change the way the BOM is imported?
t
Suppress doesn’t look like solution
e
@turansky for now I have simply removed the BOM import, and instead I'm specifying each version manually
t
I use similar workaround
h
Why do you use enforcedPlatform and not just platform?
e
@hfhbd that's actually a good question. I guess my answer is I've followed the docs example, no other reason
v
Then report a doc bug 🙂
enforcedPlatform
should very rarely be used. It is only a big hammer for edge cases. In typical cases, you should use
platform
and especially in libraries enforced platform is very bad
👀 1
e
Thanks guys,
platform
works nicely. Another KMP problem gone for my project
👌🏾 1
👌 2