正如标题所述,我想知道如何修改它gradle.build.kts以便创建一个独特jar的所有依赖项(包括kotlin lib)的任务.
我在Groovy中找到了这个示例:
//create a single Jar with all dependencies
task fatJar(type: Jar) {
manifest {
attributes 'Implementation-Title': 'Gradle Jar File Example',
'Implementation-Version': version,
'Main-Class': 'com.mkyong.DateUtils'
}
baseName = project.name + '-all'
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
Run Code Online (Sandbox Code Playgroud)
但我不知道如何在kotlin中写出来,除了:
task("fatJar") {
}
Run Code Online (Sandbox Code Playgroud) 最简单的Kotlin hello world for gradle script Kotlin:
thufir@dur:~/github/gradleScriptKotlin$
thufir@dur:~/github/gradleScriptKotlin$ gradle clean shadowJar;java -jar build/libs/gradleScriptKotlin.jar
> Task :compileKotlin
Using Kotlin incremental compilation
> Task :shadowJar
A problem was found with the configuration of task ':shadowJar'. Registering invalid inputs and outputs via TaskInputs and TaskOutputs methods has been deprecated and is scheduled to be removed in Gradle 5.0.
- No value has been specified for property 'mainClassName'.
The SimpleWorkResult type has been deprecated and is scheduled to be removed in Gradle …Run Code Online (Sandbox Code Playgroud)