can frontend-maven-plugin use node, npm already installed?
Finally, it is now possible to skip node and npm installation as detailed below:
https://github.com/eirslett/frontend-maven-plugin/issues/768
<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<phase>...</phase>
<configuration>
<skip>true</skip>
<nodeVersion>...</nodeVersion>
<npmVersion>...</npmVersion>
</configuration>
</execution>
The plugin has been designed to use a local installation of node. Using a globally installed version has been requested before but the developer's position is that node does not take up much space and will only download if missing.
Installing node locally allows developers that have not installed node globally or are using different versions to build the project without having to do anything more complicated than mvn clean install
.
You can use the exec plugin run your globally installed version of npm and then grunt. Something like:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.5.0</version>
<executions>
<execution>
<id>run-npm-install</id>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>npm</executable>
<arguments>
<argument>install</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>run-grunt</id>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>grunt</executable>
<arguments>
<argument>--no-color</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>