gpt4 book ai didi

java - 无法打开 .jar 中的嵌套条目

转载 作者:行者123 更新时间:2023-12-04 20:19:40 25 4
gpt4 key购买 nike

我有与 spring boot loader 一起运行的 .jar:

apply plugin: 'spring-boot'

jar {
into('lib') {
from configurations.runtime
}
manifest {
attributes("Implementation-Vendor": "tttt",
"Implementation-Title": project.name,
"Implementation-Version": version,
"Implementation-Vendor-Id": "tttt",
"Built-By": "Administrator",
"Build-Jdk": "1.7.0_101",
"Start-Class": "org.cp.Application",
"Spring-Boot-Version": "1.3.3.RELEASE",
"Main-Class": "org.springframework.boot.loader.JarLauncher")
}
}

我运行我的构建:

:ttt:compileJava
:ttt:processResources
:ttt:classes
:ttt:findMainClass
:ttt:jar
:ttt:bootRepackage
:ttt:assemble
:ttt:check
:ttt:build

java -jar tttt.jar:

java.lang.IllegalStateException: Unable to open nested entry 'lib/spring-boot-starter-1.3.3.RELEASE.jar'. It has been compressed and nested jar files must be stored without compression. Please check the mechanism used to create your executable jar file
at org.springframework.boot.loader.jar.JarFile.createJarFileFromFileEntry(JarFile.java:382)
at org.springframework.boot.loader.jar.JarFile.createJarFileFromEntry(JarFile.java:357)
at org.springframework.boot.loader.jar.JarFile.getNestedJarFile(JarFile.java:343)
at org.springframework.boot.loader.archive.JarFileArchive.getNestedArchive(JarFileArchive.java:112)
at org.springframework.boot.loader.archive.JarFileArchive.getNestedArchives(JarFileArchive.java:96)
at org.springframework.boot.loader.ExecutableArchiveLauncher.getClassPathArchives(ExecutableArchiveLauncher.java:75)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:60)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52)

如果这意味着什么,我手动将 spring.boot.loader 展开到 src/main/resources 中。我在这里做错了什么?

最佳答案

您不能在 JAR 中执行 Jar。如果你需要这样做,那么你必须将依赖的 JAR 添加到环境变量并使用它。

关于java - 无法打开 .jar 中的嵌套条目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37969199/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com