我正在使用spring-boot-maven-plugin:2.1.0.RELEASE打包我的主线应用程序。这个应用程序有所有常见的依赖项等打包
在一个单独的项目中,我使用maven-shade-plugin:2.4.3构建了一个shaded jar,并使用org.codehaus.mojo:truezip-maven-plugin:1.1注入到BOOT-INF/lib目录下的spring Boot 应用程序中。
ingester_1 | Listening for transport dt_socket at address: 40500
ingester_1 | Exception in thread "main" java.lang.IllegalStateException: Failed to get nested archive for entry BOOT-INF/lib/ms-holdings-package-docker-DEV.0.0-SNAPSHOT.jar
ingester_1 | at org.springframework.boot.loader.archive.JarFileArchive.getNestedArchive(JarFileArchive.java:108)
ingester_1 | at org.springframework.boot.loader.archive.JarFileArchive.getNestedArchives(JarFileArchive.java:86)
ingester_1 | at org.springframework.boot.loader.ExecutableArchiveLauncher.getClassPathArchives(ExecutableArchiveLauncher.java:70)
ingester_1 | at org.springframework.boot.loader.Launcher.launch(Launcher.java:49)
ingester_1 | at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
ingester_1 | Caused by: java.io.IOException: Unable to open nested jar file 'BOOT-INF/lib/ms-holdings-package-docker-DEV.0.0-SNAPSHOT.jar'
ingester_1 | at org.springframework.boot.loader.jar.JarFile.getNestedJarFile(JarFile.java:256)
ingester_1 | at org.springframework.boot.loader.jar.JarFile.getNestedJarFile(JarFile.java:241)
ingester_1 | at org.springframework.boot.loader.archive.JarFileArchive.getNestedArchive(JarFileArchive.java:103)
ingester_1 | ... 4 more
ingester_1 | Caused by: java.lang.IllegalStateException: Unable to open nested entry 'BOOT-INF/lib/ms-holdings-package-docker-DEV.0.0-SNAPSHOT.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
ingester_1 | at org.springframework.boot.loader.jar.JarFile.createJarFileFromFileEntry(JarFile.java:284)
ingester_1 | at org.springframework.boot.loader.jar.JarFile.createJarFileFromEntry(JarFile.java:264)
ingester_1 | at org.springframework.boot.loader.jar.JarFile.getNestedJarFile(JarFile.java:252)
ingester_1 | ... 6 more
我试着直接复制BOOT-INF/lib里面的jar文件,把maven-truezip-plugin取出来,但是还是一样。有什么办法可以解决这个问题吗?或者是一个变通方案?
3条答案
按热度按时间biswetbf1#
可以在我的maven包构建中解决这个问题;
我的pom现在有以下附加步骤;
7fhtutme2#
对我们来说,同样的失败消息,修复是只使用
spring-boot-maven-plugin
(为您创建一个可运行的jar),而不是使用shade插件并从该jar运行它。zwghvu4y3#
在构建jar时将其添加到插件配置中。