Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Packaging a Play! application straight into a WAR

I am using Play's war command to package up my application into a WAR file for deployment, like so:

play war mydir -o myapp --zip

(Discovering --zip has sure saved me a lot of time!) This command creates a WAR file myapp.war just like it's supposed to, and also an exploded version of the WAR in a directory myapp/.

I've changed the names of my directories to avoid confusion, but often I want the WAR file to have the same name as my app directory (mydir, in this example). play war mydir -o mydir --zip fails, of course, rather than overwrite my app directory, which is good.

In a case like this I'd like Play! to skip the directory bit and just get my app straight into a WAR file. Actually, name conflict or not, I'd like to do that anyway; my server is not the same as my dev box, so I just move the WAR file and don't do anything with the exploded version.

So, is there some way to get Play to skip making the exploded version? I've consulted play help war to no avail.

like image 764
andronikus Avatar asked Oct 05 '11 20:10

andronikus


1 Answers

OK, I feel kinda lazy for having asked this. Clearly I can just do it myself:

play war mydir -o myapp --zip
rm -rf myapp
mv myapp.war mydir.war

or for Windows

play war mydir -o myapp --zip
rmdir /S myapp
move myapp.war mydir.war

and drop those commands in a .sh/.bat file. Hope that helps someone in the future.

like image 80
andronikus Avatar answered Nov 09 '22 12:11

andronikus