简体   繁体   中英

Compress folder to .WAR file using PowerShell

I have a folder on my D drive ( D://MyFolder ), which I want to compress into a .WAR file ( D://MyFolder.war ).

I am trying to automate a deployment process using PowerShell, so I am looking for a PowerShell (or MS command line) command to do this.

I've tried to google and scourge StackOverflow, but haven't been able to find anything yet. This is my first 'PowerShell Adventure', so I'm not entirely sure if/how I can do this?

Many thanks for your help.

What about simple (if you do not have JAVA_HOME which you can check with env | sls JAVA_HOME ):

cd D:\MyFolder
& "<path_to_your_java>\bin\java.exe" -cvf my_folder.war *

java options:

-c  create new archive
-v  generate verbose output on standard output
-f  specify archive file name

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM