Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing NodeJS via Maven

I see a lot of newer Maven plugins for JavaScript require NodeJS to be installed on the machine where the build takes place (both local and CI servers). For example: yeoman-maven-plugin, npm-maven-plugin, etc.

The question is: Does it make sense to check for existence of NodeJS and install it if missing via Maven as a dependency?

Bonus question: If you think this is a good idea, how would you accomplish this task?

like image 741
dbrin Avatar asked Jul 11 '13 16:07

dbrin


People also ask

Can Maven be used for Nodejs?

The frontend-maven-plugin defines goals for specific tools like grunt, gulp, karma, whereas the nodejs-maven-plugin has just one generic run goals that lets you execute any Node. js-based tool.

Is Maven equivalent to NPM?

Maven is the most popular build and dependency resolution tool for Java, just like NPM is for JS. But it's not just the same tool for a different language. There are obviously huge differences between Java and JS builds, and these differences are directly visible in the way Maven operates.

Can frontend Maven plugin use Node NPM already installed?

This plugin downloads/installs Node and NPM locally for your project, runs npm install , and then any combination of Bower, Grunt, Gulp, Jspm, Karma, or Webpack. It's supposed to work on Windows, OS X and Linux.


1 Answers

You could try the frontend-maven-plugin (via https://stackoverflow.com/a/19600777/1024571). According the docs:

This plugin downloads/installs Node and NPM locally for your project, runs NPM install, Grunt and/or Karma

Basically it allows you to use Node as part of your build process without requiring it to be installed globally on the build machine.

like image 184
Jeff Smith Avatar answered Sep 28 '22 03:09

Jeff Smith