Linux command for extracting war file?

前端 未结 5 588
借酒劲吻你
借酒劲吻你 2020-12-23 14:03

How can I extract a .war file with Linux command prompt?

相关标签:
5条回答
  • 2020-12-23 14:39

    A war file is just a zip file with a specific directory structure. So you can use unzip or the jar tool for unzipping.

    But you probably don't want to do that. If you add the war file into the webapps directory of Tomcat the Tomcat will take care of extracting/installing the war file.

    0 讨论(0)
  • 2020-12-23 14:46

    Extracting a specific folder (directory) within war file:

    # unzip <war file> '<folder to extract/*>' -d <destination path> 
    unzip app##123.war 'some-dir/*' -d extracted/
    

    You get ./extracted/some-dir/ as a result.

    0 讨论(0)
  • 2020-12-23 14:56

    Using unzip

    unzip -c whatever.war META-INF/MANIFEST.MF  
    

    It will print the output in terminal.

    And for extracting all the files,

     unzip whatever.war
    

    Using jar

    jar xvf test.war
    

    Note! The jar command will extract war contents to current directory. Not to a subdirectory (like Tomcat does).

    0 讨论(0)
  • 2020-12-23 14:59

    Or

    jar xvf myproject.war

    0 讨论(0)
  • 2020-12-23 15:05

    You can use the unzip command.

    0 讨论(0)
提交回复
热议问题