【发布时间】:2019-03-19 21:00:21
【问题描述】:
我有一个带有 JDA API 的 Kotlin 项目,我需要将它部署在 Heroku 环境中。为此,我在 build.gradle 文件中创建了一个 JAR 任务。
jar {
baseName = 'discord-stats-bot'
version = 'v1'
manifest {
attributes('Main-Class': 'com.vchernogorov.discordbot.BotKt')
}
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
}
但由于以下错误,我无法构建此 JAR 文件。
16:02:03 vchernogorov $ ./gradlew jar
:kaptGenerateStubsKotlin UP-TO-DATE
:kaptKotlin UP-TO-DATE
:compileKotlin UP-TO-DATE
:compileJava UP-TO-DATE
:copyMainKotlinClasses UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:inspectClassesForKotlinIC UP-TO-DATE
:jar
FAILURE: Build failed with an exception.
* What went wrong:
Could not expand ZIP '/Users/vchernogorov/.gradle/caches/modules-2/files-2.1/club.minnced/opus-java/1.0.4/596995aaf2f5b5091c4d251fdc11fa62680cc59e/opus-java-1.0.4.pom'.
> archive is not a ZIP archive
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 6.784 secs
此库是 JDA 项目中的依赖项。所以我需要帮助来配置这个jar 任务,以便正确构建我的可执行文件并将其部署到 Heroku。
编辑:这是我在build.gradle 中的dependencies 块。
dependencies {
compile 'com.google.guava:guava:23.0'
compile "org.jetbrains.kotlinx:kotlinx-coroutines-core:0.16"
compile "org.jsoup:jsoup:1.10.3"
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile "net.dv8tion:JDA:3.8.0_436"
compile "khttp:khttp:0.1.0"
compile 'com.google.code.gson:gson:2.8.1'
}
【问题讨论】:
-
你能分享
dependencies块吗? -
添加了
dependencies块。
标签: gradle build kotlin dependencies build.gradle