The various problems of jar packaging were finally solved perfectly [Transfer]

When the local jar package is transmitted to the server, the transmission time will be very long because the network is too slow. At this time, the changed class file can be transmitted to the server (faster), and then use the jar command to repackage

The most perfect command so far:
Before the command, first come to the directory structure diagram of the file:

Note: -m contains the list information in the specified list file. The last parameter above is the number zero, which means that the compression rate is 0, not the letter O. It is necessary to see clearly.

jar -cvfm0 newJarName.jar     META-INF/MANIFEST.MF    BOOT-INF/    org/

That's it. This is the most perfect command I have used after stepping on the pit. The package typed out in this way prevents the springboot project from starting.

The process of stepping on the pit:

1. Use the command for the first time:


jar -cvfm BOOT-INF/ META-INF/ org/
Packaging failed:
prompt: BOOT-INF denies access
Then I thought, is it a problem with the parameter m, and then I removed the parameter m, and the packaging was successful

2. Use the command for the second time

jar -cvf BOOT-INF/ META-INF/ org/
successfully packaged:
run the jar package and report an error: it prompts that there is no error such as the main list attribute.
Run: jar /? Check the function of the m parameter:

It turns out that the m parameter is for this.

3. The third time is actually based on the first order

I am guessing whether it is the order of the following parameters or something. Finally, after adjusting the order and exposing this, I found that
this command is:
jar -cvfm newJarName.jar META-INF/MANIFEST.MF BOOT-INF/org /

But an error is reported: Unable to open nested entry "BOOT-INF/**" and so on. I checked the Internet and found that the
jar command will compress the third-party jar package by default (that is, the jar package of the lib folder under BOOT-INF ), so adding parameter 0 (zero) eventually succeeds.

It's too hard for me
, please forgive me for not tidying up the format and pasting it directly.
————————————————
Copyright statement: This article is an original article of CSDN blogger "cells-0", following the CC 4.0 BY-SA copyright agreement, please attach the original source link and this statement.
Original link: https://blog.csdn.net/zhaokai0130/article/details/103230118

Feeling empty and lonely simply because you have nothing to pay attention to and nothing to give.

Guess you like

Origin blog.csdn.net/m0_57326142/article/details/127507223