Edoardo Luppi
08/10/2023, 4:43 PMgetByName("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:
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?turansky
08/10/2023, 5:02 PMEdoardo Luppi
08/10/2023, 5:18 PMturansky
08/10/2023, 5:20 PMhfhbd
08/10/2023, 5:22 PMEdoardo Luppi
08/10/2023, 5:25 PMVampire
08/10/2023, 5:30 PMVampire
08/10/2023, 5:31 PMenforcedPlatform
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 badEdoardo Luppi
08/10/2023, 5:36 PMplatform
works nicely. Another KMP problem gone for my project