Scenario: Package files under the Project_a folder into Project.war
1. Packaging
JAR-XVF project.war/project_a
Description
-C Create War package
-V Show Process information
-f Specifies the JAR file name, usually this parameter is required
-M does not produce a manifest for all items (the Manifest) file, this parameter ignores the-m parameter
-0 This is the Arabic numeral, only packing does not compress the meaning
2. Unzip
JAR-XVF Project.war
Note: Unzip to the current directory
Detailed jar command
Using the jar command without any, we can see the use of the Jar command as follows:
jar {ctxu}[vfm0m] [jar-file] [manifest-file] [-C directory] File name ...
where {CTXU} is a subcommand of the jar command, each time the jar command can contain only one of the CTXU, each of which represents:
-C Create a new JAR file package
-t lists the contents list of the JAR file package
-X expands the specified file or all files of the JAR package
-U update the existing jar package (add file to jar file package)
In particular, in the release of the parameters, c/x/t/u can only exist one! Cannot exist at the same time!
Because it is not possible to compress and decompress simultaneously.
-Z: Do you have the properties of gzip at the same time? i.e. do I need gzip compression?
-j: Do you have bzip2 properties at the same time? i.e. is it necessary to compress with bzip2?
-V: Files are displayed during compression! This is commonly used, but is not recommended for use in the background execution process!
-f Specifies the JAR file name, usually this parameter is required
Please note that after f you need to pick up the file name immediately! Don't add any more arguments!
For example, using "TAR-ZCVFP tfile sfile" is the wrong way to write
"TAR-ZCVPF tfile sfile" Just right!
-P: Use original file properties (attributes are not changed according to user)
-P: You can use absolute path to compress!
-N: Newer than next date (YYYY/MM/DD) will be packaged in the new file!
–exclude file: In the process of compression, do not package file!
-m Specifies the MANIFEST manifest file that needs to be included
-0 storage, no compression, so that the resulting JAR package will be larger than the size without the parameter, but faster
-M does not produce a manifest for all items (the Manifest) file, this parameter ignores the-m parameter
[jar-file] is a jar package that needs to be generated, viewed, updated, or unpacked, which is a subordinate parameter to the-f parameter
[manifest-file] is the manifest manifest file, which is a dependent parameter of the-m parameter
The [-C directory] represents the action that goes to the specified directory to execute the jar command. It is equivalent to using the CD command to go to the directory and then execute the JAR command without the-c parameter, which can only be used when creating and updating jar packages.
Filename... Specifies a list of files/directories that are files/directories to add to the JAR package. If a directory is specified, the jar command automatically packages all files and subdirectories in the directory when it is packaged.
Pack compressed war, Unzip war package and Jar command under Linux