I\'m trying to execute grunt tasks from within maven without needing to install Node.js or anything. This is because I wan\'t my artifact to be packaged by Jenkins and I can\'t
This is a full copy/paste solution which work in 2017 using frontend-maven-plugin for front build, and maven-war-plugin to build the war.
What it does ? install npm, bower grunt,and everything you need, then run npm install, bower install and finally grunt build.
You can remove/add replace the steps you want, for me it's a full 30 sec install/build library and project.
...
com.github.eirslett
frontend-maven-plugin
org.apache.maven.plugins
maven-war-plugin
2.4
src/main/webapp/YourFrontJsFolder/dist
YouWarName
false
node_modules/**
system
WebContent/WEB-INF
WEB-INF
**/*.jar
**/*.jsp
org.apache.maven.plugins
maven-compiler-plugin
3.3
1.7
Cp1252
YourAppName
release
com.github.eirslett
frontend-maven-plugin
install node and npm
install-node-and-npm
generate-resources
v7.6.0
npm install
npm
generate-resources
install
bower install
bower
install
grunt build
grunt
generate-resources
build
target
src/main/webapp/YourFrontJsFolder
debug
true
IDE
m2e.version
target-ide
Then you can Run as
-> Maven build ...
, with goal clean install
and profile release