As to shadow
plugin (com.github.johnrengelman.shadow
), the situation is as follows.
-
in case of using
jvmWithJava
target, it should work as is, just apply it from the top level of thebuild.gradle
script. Note, hovewer, that the target is going to be deprecated as it’s already said above. -
when using with
jvm
target, an additional task definition is needed, like the following:task shadowJar(type: com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) { def target = kotlin.targets.jvm6 from target.compilations.main.output def runtimeClasspath = target.compilations.main.runtimeDependencyFiles configurations = [runtimeClasspath] }
— where
jvm6
is the JVM target’s name.So overall
build.gradle
will look like:group 'com.example' version '1.0' buildscript { repositories { jcenter() } dependencies { classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.10' classpath 'com.github.jengelman.gradle.plugins:shadow:4.0.2' } } apply plugin: 'kotlin-multiplatform' apply plugin: 'com.github.johnrengelman.shadow' repositories { jcenter() } kotlin { targets { fromPreset(presets.jvm, 'jvm6') } sourceSets { commonMain { dependencies { api 'org.jetbrains.kotlin:kotlin-stdlib-common' } } jvm6Main { dependencies { api 'org.jetbrains.kotlin:kotlin-stdlib' } } } } task shadowJar(type: com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) { from kotlin.targets.jvm6.compilations.main.output def runtimeClasspath = kotlin.targets.jvm6.compilations.main.runtimeDependencyFiles configurations = [runtimeClasspath]
The support of kotlin-frontend plugin for JS is in progress right now, you may track the progress via this issue.