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 ?
- 什么是kotlin-gradle-plugin和kotlin-js-library之间的正确版本匹配?
- 添加一个Fragment后,Android工作室分解了我的build.gradle文件
- 无法运行jar文件。 (错误:无法find或加载主类co.pissarra.Mainkt)
- 我怎样才能用gradle运行kotlintest测试?
- Gradle,’url’不能用于(java.lang.String)
- java.lang.RuntimeException:java.lang.RuntimeException:com.android.builder.dexing.DexArchiveMergerException:无法合并dex
- 如何覆盖gradle kotlin-dsl中的任务
- Android Studio 3.0 Kotlin的变化并没有体现在构建中
- Android kotlin项目生成卡在应用程序:kaptDebugKotlin任务