Kotlin脚本Gradle:build.gradle.kts和ShadowJar
清理生成并运行:
thufir@dur:~/NetBeansProjects/kotlinShadowJar$ thufir@dur:~/NetBeansProjects/kotlinShadowJar$ gradle clean ShadowJar;java -jar build/libs/Hiya.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 5.0. Please use WorkResults.didWork() instead. BUILD SUCCESSFUL in 1s 3 actionable tasks: 3 executed Hello, world! thufir@dur:~/NetBeansProjects/kotlinShadowJar$
gradle构建文件:
plugins { id 'com.gradle.build-scan' version '1.8' id 'java' id 'application' id "org.jetbrains.kotlin.jvm" version "1.1.51" id 'com.github.johnrengelman.shadow' version '2.0.1' } buildScan { licenseAgreementUrl = 'https://gradle.com/terms-of-service' licenseAgree = 'yes' //publishAlways() } repositories { jcenter() } sourceCompatibility = 1.8 targetCompatibility = 1.8 shadowJar { baseName = 'Hiya' classifier = null version = null } dependencies { compile "org.jetbrains.kotlin:kotlin-stdlib:1.1.51" } mainClassName = 'foo.HelloWorldKt'
科特林代码:
package foo //import kotlin.jvm.JvmStatic //@JvmStatic fun main(args: Array) { println("Hello, world!") }
我只是在检查Kotlin的确是按照预期的方法,用 Gradle中的ShadowJar
插件来建立一个JAR
。 它做得很好。
如何将这个构建文件从Gradle DSL转换/翻译成Gradle脚本Kotlin ?
- 库与Gradle 3.0.0-alphaX的依赖关系问题
- IntelliJ中的Gradle SourceSet依赖关系
- kotlin-gradle插件自动配置错误
- 具有不同源代码集的Gradle任务
- 在Gradle中分割所有输出目录
- 无法解析:用于电话号码身份验证的com.google.firebase:firebase-auth:11.0.2
- java.lang.NoClassDefFoundError:kotlin / jvm / internal / intrinsics in libgdx
- Android Studio 3.0 Kotlin的变化并没有体现在构建中
- 在Android Studio 3.0 Canary中,Gradle Sync失败