Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
527 views
in Technique[技术] by (71.8m points)

kotlin - How to pass compile args to kotlinc with gradle

I tried this but failed i want to pass -include-runtime but the jar file dont have those classes im using gradle 6.7. and my ide says: No candidates found for method call kotlinOptions. but gradle still can run task "build"

and i also tried shadow plugin. it successed.. but i dont want shadow plugin to pack other optional depencies(optional is only relative to software, not compiling software is optional, so "compile" is what i used.). is there a way to only pack kotlin runtime to the jar file?

use compiler args:

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
    kotlinOptions {
        jvmTarget = '1.8'
        freeCompilerArgs += '-include-runtime'
    }
}

use shadow plugin:

shadowJar {
    baseName = 'Test'
}
question from:https://stackoverflow.com/questions/65931453/how-to-pass-compile-args-to-kotlinc-with-gradle

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...