Karel-Jan Misseghers
Karel-Jan Misseghers

Reputation: 807

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.

Upvotes: 1

Views: 1649

Answers (1)

tukan
tukan

Reputation: 17355

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

Upvotes: 1

Related Questions