https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
a

altavir

07/10/2019, 8:09 AM
Could you remind me how to add JavaExec task to mutliplatform? I believe it was answered several times, but I forgot again.
d

Dominaezzz

07/10/2019, 8:57 AM
With
1.3.40
you can now use the application gradle plugin.
a

altavir

07/10/2019, 8:58 AM
Oh? I think I've missed that. I will try it, thanks
d

Dominaezzz

07/10/2019, 8:59 AM
No problem.
a

altavir

07/10/2019, 9:00 AM
I've already solved the problem with
Copy code
tasks.register<JavaExec>("runSwing") {
    group = "run"
    val target = kotlin.targets["jvm"]
    val compilation: KotlinCompilationToRunnableFiles<KotlinCommonOptions> =
        target.compilations["main"] as KotlinCompilationToRunnableFiles<KotlinCommonOptions>

    val classes = files(
        compilation.runtimeDependencyFiles,
        compilation.output.allOutputs
    )
    classpath = classes


    main = "ru.mipt.phys.diffraction.AppFrameKt"
}
but application is better.
Does not seem to work with application plugin with default configuration. Are there any examples?
Solved it myself. I just needed to add
withJava()
to jvm configuration
2 Views