Reece H. Dunn
05/03/2023, 7:30 AMproject-a-jvm11
, etc. This is similar to naming the native target based on the KonanTarget name.
In my build.gradle.kts script for project B, I'm importing project A as implementation("group-id:project-a:version")
. The build here is failing to locate the project-a-jvm11
artifact, as it is looking for project-a-jvm
. -- This is because it does not know about my custom naming scheme, but also does not know how to resolve the dependency based on the JVM target.Adam S
05/03/2023, 7:37 AM-jvm
, are determined automatically using the name of the target. Updating the publication artifact name manually will probably disrupt that, and not in the way you want.
If you wanted to change the name of the suffix then you can do that by renaming the target in the build.gradle.kts
// build.gradle.kts
plugins {
kotlin("multiplatform")
}
kotlin {
jvm("jvm11") // custom target name of 'jvm11'
}
That will produce group-id:project-a-jvm11:version
EDIT actually I’m not sure if it will… maybe the suffix is based on the platform, which will always be -jvm
? 🤔
Try taking a look at this answer for an overview of how the suffixes work: https://stackoverflow.com/questions/73914158/how-does-gradle-choose-actually-libraries-ending-with-jvm/73919346#73919346Reece H. Dunn
05/03/2023, 7:42 AMAdam S
05/03/2023, 7:47 AMorg.gradle.jvm.version
JVM attribute https://docs.gradle.org/current/userguide/variant_attributes.html#sub:jvm_default_attributes, that might be something useful…
kotlin {
jvm("jvm11") {
attributes.attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 11)
}
}
but as I’m explaining it, I can see how complicated and confusing it is, and it’s probably unnecessary…Reece H. Dunn
05/03/2023, 7:50 AMAdam S
05/03/2023, 8:09 AMReece H. Dunn
05/03/2023, 8:11 AM