spring boot jar包替换报错之Unable to open nested entry 'BOOT-INF/lib/cache-api-0.4.jar'.

spring boot用layout ZIP打出来的包能够支持外部classpath,但是当用rar/7zip替换其中的jar后,报下列错误:

Unable to open nested entry 'BOOT-INF/lib/cache-api-0.4.jar'.
It has been compressed and nested jar files must be stored without compression.

 解决方法:

jar包可以替换的,过程如下:
jar jar -xvf ta-base-service-TABASEV201913.00.000-SNAPSHOT.jar
### 替换内容
jar -cfM0 ta-base-service-TABASEV201913.00.000-SNAPSHOT.jar ./
不能用rar或7-zip替换

最好方式还是将应用的jar放在spring boot主应用jar外面的目录中。这可以通过maven-jar-plugin来实现将某些jar不打包到spring boot应用jar中,而是放在特定目录中。

猜你喜欢

转载自www.cnblogs.com/zhjh256/p/10986920.html