Reputation: 1559
I am getting below error while integrating Grunt with Maven. I have gone through similar questions on stackoverflow and it didn't help me hence I am asking it again. I have a Gruntfile.js and package.json file both at the root level of project. I have also added relevant entries in pom.xml for installing npm , node and grunt. When I run the maven build , it does create 2 folders Node and Node_modules and I can see that grunt_cli and other modules are installed but still I am getting below error.
I am new to Grunt and Node. Please guide, what am I missing here?
Errors:- Error 1 ->Local Npm module "grunt-cli" not found. Is it installed?
Error 2 ->Failed to execute goal com.github.eirslett:frontend-maven-plugin:0.0.16:grunt (grunt build ) on project my_project: Failed to run task: 'grunt --no-color' failed. (error code 3)
pom.xml
<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>
package.json
{
"name": "myProject",
"version": "0.1.0",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-copy": "~0.4.1",
"grunt-contrib-jshint": "~0.10.0",
"matchdep": "~0.3.0",
"grunt-ngmin": "0.0.3",
"grunt-contrib-uglify": "~0.2.7",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-cssmin": "~0.7.0",
"grunt-text-replace": "^0.3.11",
"grunt-usemin": "~2.0.0",
"mkdirp": "^0.4.1",
"moment": "^2.6.0",
"grunt-protractor-runner": "^0.2.4",
"node-promise": "^0.5.10",
"xml2js": "^0.4.3",
"request": "^2.36.0",
"grunt-cli": "~0.1.11"
}
}
Upvotes: 2
Views: 2242
Reputation: 36
Try to remove the following snippet from your pom.xml
<execution>
<id> npm run build </id>
<goals>
<goal>npm </goal>
</goals>
<configuration>
<arguments> run build </arguments>
</configuration>
</execution>
Default argument of grunt
goal is build
.
If you put the argument --no-color
you should also add the build
argument.
Upvotes: 1