** Environment without build tools ** (only JDK can be used) Some of the resources (no compilation required) included in the Spring Boot executable jar file (Is fat jar the official name?) A note when ** replacement ** is needed and ** managed with the ** jar command **.
I didn't have much time, so I came up with the method I did with ** Eh **.
Work path configuration (partial)
+ (Working directory)
  + work
    + BOOT-INF
      + classes
      + lib
    + META-INF
      + MANIFEST.MF
    + org
      + springframework
        + ...
command
jar cvfm0 Hoge.jar ./work/META-INF/MANIFEST.MF -C ./work .
I have an executable jar file, but the 0 option makes ** all files uncompressed **, which causes the file size to grow ** several times **. .. ..
I wanted to uncompress only the jar files under BOOT-INF / lib, so I tried to find out how to do it after calming down.
As a preliminary preparation, move only the jar files under BOOT-INF / lib to another path.
Working path configuration (partly BOOT-INF/(After moving lib)
+ (Working directory)
  + work
    + BOOT-INF
      + classes
    + META-INF
      + MANIFEST.MF
    + org
      + springframework
        + ...
  + work2
    + BOOT-INF
      + lib
command
jar cvfm Hoge.jar ./work/META-INF/MANIFEST.MF -C ./work .
jar uvf0 Hoge.jar -C ./work2 .
Just like the original jar file, we now have an executable jar file that contains only the jar files under BOOT-INF / lib uncompressed.
Recommended Posts