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 pom.xml
.
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 pom.xml
:
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!
Hi ,
In directory C:testtest_app i have makefile and two c files,
makefile has*********
test: test.c test1.c
gcc test.c -o test
test1: test1.c
gcc test1.c -o test1
clean:
rm -rf test
*****************
pom.xml has ***********
4.0.0
nds.test.app
test_app
jar
1.0-SNAPSHOT1
test_app
http://maven.apache.org
junit
junit
3.8.1
test
**************
please tel me what changes i need to know in POM.xml to call makefile and get the result.