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 ?
- 转换字节码时出错 – DexException – Firebase身份验证
- 在多项目设置中ConfigurationsContainer为空
- 'com.android.tools.build:gradle:3.0.0-alpha3'和'com.android.tools.build:gradle:3.0.0-alpha1'有什么区别?
- Java和Kotlin组合生成错误(重复邮编条目)
- Gradle构建失败,Kotlin,Scala和Java
- 编译Android项目
- 如何将kotlin-js-library更新为1.1.3,就像kotlin-gradle-plugin一样?
- Android Studio 3.0 Kotlin的变化并没有体现在构建中
- Gradle子项目排序并生成jar(spring boot + angular)