I have two projects in a composite gradle build, the first multiplatform the second simple Java. The Java project needs the .jar file produced by the multiplatform project. Which task should I depend on from the first project? I tried
build
but it doesn't seem to work. The jar file is actually produced at the end, but not before the tests from the second project run, so my tests fail because of the missing jar file.
v
Vampire
06/01/2024, 9:47 AM
I'm not too familiar with KMP, but you should never depend on any task explicitly anyway (except with a lifecycle task on the left-hand side), especially not in another project. If you need the artifact of the other project, add a dependency on that other project.
thank you color 1
👍 1
t
Tóth István Zoltán
06/02/2024, 2:08 AM
Uh, oh, I had the other project included in the composite but not between the dependencies. 🙂 Thank you.
👌 1
c
CLOVIS
06/02/2024, 1:51 PM
@Vampire for future reference: KMP exposes all platform-specific artifacts as variants in the module metadata, so you can just declare a dependency and Gradle will find the artifact expected for the JVM by itself
v
Vampire
06/02/2024, 2:04 PM
Yes, I know.
That's exactly what I told him, to add a dependency, but thanks. :-)
c
CLOVIS
06/02/2024, 2:07 PM
Ah, no problem. Since you said "I'm not too familiar with KMP", I thought maybe you didn't 🙂
v
Vampire
06/02/2024, 2:09 PM
Sure, appreciate it.
I also learn something new every day, could have been that. 😄