I’m wondering what is the purpose of `withJava()` ...
# compose-desktop
n
I’m wondering what is the purpose of
withJava()
and if it’s really needed by compose? • If I use it, then my dependencies are not resolved (their
jvm()
configuration doesn’t contain
withJava()
) • Otherwise I’m getting
Could not find or load main class
(not 100% sure if it’s related, but the package name looks okay, so I’m guessing
withJava
has something to do with sourceSet configuration 🤔)
a
It is needed for application and bundling plugins to work. It could be solved with a variant of https://youtrack.jetbrains.com/issue/KT-42683
👍 1
i
withJava()
was added because
application
Gradle plugin doesn't work without it. But now we don't use
application
plugin for running application, we use our own mechanism. So we can use only
jvm()
(without
withJava
).
Could not find or load main class
doesn't happened if we remove
withJava
in https://github.com/JetBrains/compose-jb/tree/master/templates/multiplatform-template project. Maybe your main class is inside
java
folder, not inside
kotlin
folder?
n
nope, it’s at
jvmMain/kotlin/Main.kt
with
Copy code
compose.desktop {
    application {
        mainClass = "MainKt"
        nativeDistributions {
            targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
            packageName = "XY"
        }
    }
}