Running external commands before generating war and customizing war file- structure

I am developing a web app using Sencha’s ext js, Sencha Architect and Spring MVC

All my extjs code is placed under “src/main/webapp”. But for being production ready I have do some war file customization.

My requirement is that before generating the war file, I have to run some sencha commands which generate production ready (minimified ,concatenated and optimized) js files inside “webapp\build\production” folder. so the war file should include the contents in “webapp\build\production” directly in the “webapp” folder.

How to run some external (sencha) commands before generating the war file in gradle ? And how to change the file structure for war file - As said earlier, how to pull contents of “webapp\build\prodcution” directly into “webapp”?

You’ll want something like ‘war.dependsOn(myTask)’. All generated code should be put somewhere under ‘build/’. Then configure the ‘war’ task to include it. ‘src/main/webapp’ is for files that should be included in the war as-is.


Did you find a way to achieve this?