3

像这样为 CF 添加 Cloud SDK: compile "com.sap.cloud.s4hana:s4hana-all:${cloudSDKVersion}" compile ("com.sap.cloud.s4hana.cloudplatform:scp-cf:${cloudSDKVersion}") 会导致部署到 CF 的 spring boot jar 中出现重复的 jar。例子: core-2.3.1.jar connectivity-2.3.1.jar

  • 这将导致 :
    • 运行时的 ClassNotFoundExceptions
    • 防止 cf push 命令出错: Comparing local files to remote cache... Aborting push: File BOOT-INF/lib/core-2.3.1.jar has been modified since the start of push. Validate the correct state of the file and try again. FAILED
4

1 回答 1

5

gradle 在构建引导包时会跳过组件名称。

经过一番谷歌搜索后,解决方案是: https ://github.com/spring-projects/spring-boot/issues/10778

bootJar {
    rootSpec.filesMatching('**/*.jar', { jar ->
        String groupId = jar.file.parentFile.parentFile.parentFile.parentFile.name
        jar.name = "$groupId-${jar.name}"
    })
}
于 2018-09-05T11:56:26.733 回答