Robert Jaros
07/24/2024, 10:21 AM2.0.20-Beta2
I see this warning w: 'java' Gradle plugin is not compatible with 'org.jetbrains.kotlin.multiplatform' plugin.
when using kotlin { jvm { withJava() } }
. I'm using latest Gradle 8.9
. Is this a known issue?Robert Jaros
07/24/2024, 10:23 AMw: 'java' Gradle plugin is not compatible with 'org.jetbrains.kotlin.multiplatform' plugin.
Consider adding a new subproject with 'java' plugin where the KMP project is added as a dependency.
w: 'application' (also applies 'java' plugin) Gradle plugin is not compatible with 'org.jetbrains.kotlin.multiplatform' plugin.
Consider adding a new subproject with 'application' plugin where the KMP project is added as a dependency.
chrisjenx
07/24/2024, 3:07 PMGary Peck
07/25/2024, 6:36 AMCLOVIS
07/25/2024, 6:55 AMRobert Jaros
07/25/2024, 6:56 AMGary Peck
07/25/2024, 7:06 AMwithJava()
, so I'm hoping that Java code in a multiplatform project is still supported. It's only the use of Java Gradle plugins in a multiplatform project that is being deprecated.CLOVIS
07/25/2024, 7:08 AMwithJava
is just a shortcut to apply the Java plugin. Unless they are going to reimplement the Java plugin into the Kotlin plugin (highly doubt it), then it does mean that withJava
won't be supported either.Robert Jaros
07/25/2024, 7:27 AMRobert Jaros
07/25/2024, 7:32 AMCLOVIS
07/25/2024, 7:33 AMCLOVIS
07/25/2024, 7:34 AMRobert Jaros
07/25/2024, 7:37 AMCLOVIS
07/25/2024, 7:38 AMRobert Jaros
07/25/2024, 7:43 AMRobert Jaros
07/25/2024, 7:48 AMRobert Jaros
07/25/2024, 7:52 AMAdam Semenenko
07/25/2024, 8:47 AMjava
, java-library
, or application
(which would be better named as java-application
) plugins, then a Java-only consumer won't be able to discriminate between the Kotlin/JVM artifact and the java
artifact.
Currently, KGP modifies the Java Configurations so that they are disabled. But Gradle will prevent this in the future.Adam Semenenko
07/25/2024, 8:48 AMAlexander.Likhachev
07/25/2024, 8:51 AMwithJava
without any deprecation warnings and put Java code along Kotlin code without any deprecation warnings. You just canโt apply `java`/`application` plugins within KMP plugin in the same project. We should clarify the Whatโs new announcement.
withJava()
call applies java-base
plugin which is totally fine and allows us to have control over the entities it createsCLOVIS
07/25/2024, 8:52 AMRobert Jaros
07/25/2024, 10:32 AMAdam Semenenko
07/25/2024, 3:28 PMjava
vs java-library
). So yes, it applies to both, because KGP has to maintain the same behaviour.Robert Jaros
07/25/2024, 3:33 PMjava
and/or application
(like Spring Boot plugin, Micronaut plugin) are dedicated for applications and could still work without problems.chrisjenx
07/25/2024, 3:35 PMchrisjenx
07/25/2024, 3:42 PM-> backend (java)
common (kmp)
-> client(kmp)
TBH I already have this (as backend started first) but would help to give a more concrete template/exampleAdam Semenenko
08/01/2024, 9:54 AMkotlin("multiplatform-application")
could work... or some sort of toggle kotlin { type = Application }
? But what about if someone did want to publish an application to Maven? Would it still work?
It would be nice if it just worked without any configuration! This is only a recent change, so we're still considering options, and talking with the Gradle team to try and make it nicer.Adam Semenenko
08/01/2024, 10:00 AMjava
, application
, and kotlin("multiplatform")
, then even if KGP had some sort of 'application only' mode that worked well, there would still be tasks/Configurations/misc stuff that would not be used. E.g. compileJava
- this task won't be run, Kotlin will handle compilation. These are unnecessary, will never be used, and and harm build performance.Robert Jaros
08/01/2024, 10:24 AMCLOVIS
08/01/2024, 10:26 AMand harm build performancehow? If they are properly lazy, unused tasks are expected to be virtually free
Adam Semenenko
08/01/2024, 1:15 PMjava
& KGP-multiplatform is required. In this case, maybe the performance impact isn't significant. But when we researched the projects that applied both java
& KGP-multiplatform, in the majority of cases java
wasn't necessary, or was only used for a single task (e.g. the Javadoc JAR)Adam Semenenko
08/01/2024, 1:21 PMjava
, it means objects are disabled. This is confusing to users & build script maintenance, consumes memory even if they are not run, might be accidentally run (E.g. gradle assemble
could trigger a Java compilation task, even though compilation is handled by KGP), and complicate Gradle wiring (E.g. task dependencies).Robert Jaros
08/01/2024, 1:21 PMjava
plugin itself, but the ecosystem of plugins of many different projects, which require the java
(or application
) plugin.Robert Jaros
08/01/2024, 1:25 PM