As a frontend web developer, I often find myself in a larger project, where I’m responsible for the frontend web app, and others work on the backend. More often than not lately, this has meant everything is a big Maven project, with several submodules. My frontend web app being one such Maven submodule.
I usually want to use Node.js and specifically
npm from a
Makefile when building “my” frontend web app. This clashes with the Maven setup, specifically in that other project members don’t always want to install Node.js just to be able to continuing building the entire project.
The specific problem of Auto-installing Node.js and npm from a
Makefile, is solved. However, it remains to call
make from inside the Maven
This is how you can call
make from inside a Maven project:
Make sure you have set up
<dependencyManagement/> like this in your parent pom:
maven-antrun-plugin 1.7 ant-contrib ant-contrib 1.0b3 ant ant org.apache.ant ant-nodeps 1.8.1
Then have this in your frontend web app’s
maven-antrun-plugin make generate-sources run
Now whenever anyone builds the project with Maven, it will call
make and the first target in
Makefile will execute.
Combine this with Auto-install Node.js and npm from Makefile, and you have a winner!