Use Java Platform in KMP Project


I have an Android App that uses Gradle Java Platform to declares all dependencies and these dependencies are constraint. I was liking this approach as this is helping in times of conflicts.

I am expanding my Project to Kotlin Multiplatform (KMP), so I can support both iOS and Android. But iOS does not support JVM code and Java Platform is not supported in my setup now.

Are there any recommendations for Java Platform to extract into something like a version catalog or a file that I can access in KMP world?

I cannot remove Java Platform as I am so deep in my other subprojects. Now, I have to maintain two files Java-Plaform a new dependency file for KMP projects but I want to make it one source.

Can you show an example of what does not work where?
Platforms are not really Java-specific, so I would have expected them to work just the same.

I have a Java-Platform that declares dependencies for all my projects.

I have a Custom Gradle Plugin project that configures all my projects and to this plugin I added KMP support and Java-Platform.

In my Android Project, when I add this plugin to build.gradle, I get all capabilities and dependencies.

In my iOS Project, when I add the same plugin, I get all capabilities but does not get dependencies.

I used Java-Platform which is designed for Java ecosystem, how do I use Platform that supports both iOS (C++/Swift) and Android(Java)?

I don’t do KMP development, but I thought that the KMP stuff is all published as Maven artifacts and thus should be “Java ecosystem” in that regard.

Also, what do you mean with you “get capabilities but not dependencies”.
A platform does not give you any dependencies, it just sets version constraints similar to a Maven BOM (which actually can be used as a platform).

Do you maybe have some MCVE, so that it is clear what we talk about exactly?