I have two projects in a composite gradle build, t...
# gradle
t
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
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
Uh, oh, I had the other project included in the composite but not between the dependencies. 🙂 Thank you.
👌 1
c
@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
Yes, I know. That's exactly what I told him, to add a dependency, but thanks. :-)
c
Ah, no problem. Since you said "I'm not too familiar with KMP", I thought maybe you didn't 🙂
v
Sure, appreciate it. I also learn something new every day, could have been that. 😄
👍 1