我正在尝试将暴露于ktor的应用程序推送到cp。我使用了在https://github.com/raharrison/kotlin-ktor-exposed-starter处找到的入门应用程序,并调整了gradle.build
文件以使用Cloud Foundry可以启动和运行的主要方法来制作一个胖子。
buildscript {
ext.kotlin_version = '1.3.31'
ext.ktor_version = '1.2.0'
ext.exposed_version = '0.13.7'
ext.h2_version = '1.4.196'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'application'
apply plugin: 'eclipse'
version = '1.0'
sourceCompatibility = 1.8
//create a single Jar with all dependencies
task fatjar(type: Jar) {
manifest { attributes 'Implementation-Title': 'Gradle Jar File Example', 'Implementation-Version': version, 'Main-Class': 'MainKt' }
baseName = project.name + '-all'
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
repositories {
jcenter()
}
test {
useJUnitPlatform()
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
compile "io.ktor:ktor-server-netty:$ktor_version"
compile "io.ktor:ktor-jackson:$ktor_version"
compile "io.ktor:ktor-websockets:$ktor_version"
compile "com.h2database:h2:$h2_version"
compile "org.jetbrains.exposed:exposed:$exposed_version"
compile 'com.zaxxer:HikariCP:3.3.1'
compile "ch.qos.logback:logback-classic:1.2.1"
testCompile "org.assertj:assertj-core:3.11.1"
testCompile "io.rest-assured:rest-assured:3.3.0"
testCompile "org.junit.jupiter:junit-jupiter-api:5.4.0"
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.4.0'
}
gradle fatJar
之后,我可以在本地运行此jar,但是当我使用cf push
时,出现以下错误
Mapping routes...
Comparing local files to remote cache...
Aborting push: File META-INF/kotlinx-coroutines-io.kotlin_module has been modified since the start of push. Validate the correct state of the file and try again.
FAILED
这是怎么回事?似乎我的jar中有一个文件总是被修改,即使没有启动过jar。我可以猜测一下协程模块为何会不断修改,但我不知道如何阻止它。