Node.js 与Maven的Grunt集成
在将Grunt与Maven集成时,我遇到了以下错误。我在stackoverflow上也遇到过类似的问题,但这对我没有帮助,因此我再次提出这个问题。我在项目的根级别有一个Gruntfile.js和package.json文件。我还在pom.xml中添加了相关条目,用于安装npm、node和grunt。当我运行maven构建时,它确实创建了两个文件夹Node和Node_模块,我可以看到安装了grunt_cli和其他模块,但我还是发现了下面的错误 我不熟悉咕噜和诺德。请导游,我在这里错过了什么 错误:- 错误1->未找到本地Npm模块“grunt cli”。安装了吗 错误2->无法在项目my_上执行目标com.github.eirslett:frontend maven插件:0.0.16:grunt(grunt构建):无法运行任务:“grunt--无颜色”失败。(错误代码3) pom.xmlNode.js 与Maven的Grunt集成,node.js,maven,gruntjs,npm,Node.js,Maven,Gruntjs,Npm,在将Grunt与Maven集成时,我遇到了以下错误。我在stackoverflow上也遇到过类似的问题,但这对我没有帮助,因此我再次提出这个问题。我在项目的根级别有一个Gruntfile.js和package.json文件。我还在pom.xml中添加了相关条目,用于安装npm、node和grunt。当我运行maven构建时,它确实创建了两个文件夹Node和Node_模块,我可以看到安装了grunt_cli和其他模块,但我还是发现了下面的错误 我不熟悉咕噜和诺德。请导游,我在这里错过了什么 错误:
<build>
<plugins>
<plugin>
<groupId> com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin </artifactId>
<version> 0.0.16 </version>
<configuration>
<workingDirectory>${project.basedir}/.. </workingDirectory>
</configuration>
<executions>
<execution>
<id> install node and npm </id>
<phase> generate-resources </phase>
<goals>
<goal>install-node-and-npm </goal>
</goals>
<configuration>
<nodeVersion>v0.10.18</nodeVersion>
<npmVersion>1.3.8 </npmVersion>
</configuration>
</execution>
<execution>
<id> npm install </id>
<phase> generate-resources </phase>
<goals>
<goal> npm </goal>
</goals>
<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>
</executiona>
</plugin>
<plugins>
</build>
尝试从pom.xml中删除以下代码段
<execution>
<id> npm run build </id>
<goals>
<goal>npm </goal>
</goals>
<configuration>
<arguments> run build </arguments>
</configuration>
</execution>
npm运行构建
npm
运行构建
grunt
目标的默认参数是build
。
如果您使用参数
--无颜色
,您还应该添加构建
参数。您是否尝试过前端maven插件1.0?您可能应该为所有执行项添加生成资源阶段。马文的目标是什么?
<execution>
<id> npm run build </id>
<goals>
<goal>npm </goal>
</goals>
<configuration>
<arguments> run build </arguments>
</configuration>
</execution>