相关疑难解决方法(0)

如何使用gradle kotlin脚本创建胖罐

正如标题所述,我想知道如何修改它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 build.gradle build.gradle.kts gradle-kotlin-dsl

29
推荐指数
4
解决办法
1万
查看次数

如何使用gradle脚本Kotlin构建文件构建可运行的ShadowJar?

最简单的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)

build gradle kotlin build.gradle gradle-kotlin-dsl

9
推荐指数
1
解决办法
2471
查看次数