Javascript 前端maven插件可以使用已经安装的节点npm吗?
我是使用maven和前端maven插件的新手。我知道我们可以将此代码添加到pom.xml以运行grunt,例如:Javascript 前端maven插件可以使用已经安装的节点npm吗?,javascript,node.js,maven,npm,gruntjs,Javascript,Node.js,Maven,Npm,Gruntjs,我是使用maven和前端maven插件的新手。我知道我们可以将此代码添加到pom.xml以运行grunt,例如: <plugin> <groupId>com.github.eirslett</groupId> <artifactId>frontend-maven-plugin</artifactId> <!-- NB! Set <ver
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<!-- NB! Set <version> to the latest released version of frontend-maven-plugin, like in README.md -->
<version>@project.version@</version>
<executions>
<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<configuration>
<nodeVersion>v5.3.0</nodeVersion>
<npmVersion>3.3.12</npmVersion>
</configuration>
</execution>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
<!-- Optional configuration which provides for running any npm command -->
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>npm run build</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>run build</arguments>
</configuration>
</execution>
<execution>
<id>grunt build</id>
<goals>
<goal>grunt</goal>
</goals>
<configuration>
<arguments>--no-color</arguments>
</configuration>
</execution>
</executions>
</plugin>
com.github.eirslett
前端maven插件
@project.version@
安装节点和npm
安装节点和npm
v5.3.0
3.3.12
npm安装
npm
安装
npm运行构建
npm
运行构建
咕噜声
咕哝
--没有颜色
我实际上在我的服务器上安装了node和npm
例如:node安装在/opt/app/trss/nodejs下,npm安装在/opt/app/trss/nodejs/npm下。这个pom.xml如何使用安装在我的服务器上的node、npm?感谢该插件设计为使用本地安装的node。使用全局安装的版本已经过时,但开发人员的立场是,节点不会占用太多空间,只有在丢失时才会下载 本地安装节点允许尚未全局安装节点或正在使用不同版本的开发人员构建项目,而无需执行比
mvn clean install
更复杂的操作
您可以先运行全局安装的npm版本,然后再运行grunt。比如:
<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>
org.codehaus.mojo
execmaven插件
1.5.0
运行npm安装
编译
执行官
npm
安装
咕哝
编译
执行官
咕哝
--没有颜色
这是一个老问题,但是这样做而不是使用maven前端插件可能会导致Eclipse做错误的事情,这也是相关的:
org.eclipse.m2e
生命周期映射
1.0.0
org.codehaus.mojo
execmaven插件
[1.6.0,)
执行官
真的
最后,现在可以跳过节点和npm安装,详情如下:
安装节点和npm
安装节点和npm
...
真的
...
...
有什么想法吗?如何在此插件中指定源文件夹和目标文件夹?