I couldn’t find a maven plugin that met my needs for minimizing javascript and css, so I started to create my own. However, I seem to have hit a roadblock. The minimized versions of the files always get overwritten by either the war plugin or something else.
My file structure is
src
main
java
webapp
assets
css
style1.css
style2.css
style3.css
js
script1.js
script2.js
script3.js
My plugin takes those, minimizes them, and (is supposed to) replaces them in the build directory. How to I make sure that they are not overwritten?
Where does your plugin output the altered files to? The way I see it, it’s making the necessary changes (if it works) and then the maven war plugin copies the original resources over them.
Perhaps you should attach your code and pom.xml, for a better answer.
EDIT:
After having had a look at your test project, the problem can been resolved with the following change to your pom.xml:
I am also under the impression that your modified css files are being altered into the
src/main/webapp/assetsdirectory which is incorrect. These files should only be changed after being copied over to the respective directory under the target directory.I have forked your repository and sent you a pull request.