build failing with grunt error

Hi, I saw another question that was similar to mine, my build is failing with

Results :

Tests run: 268, Failures: 0, Errors: 0, Skipped: 0

[INFO] 
[INFO] --- jacoco-maven-plugin:0.6.2.201302030002:report (report) @ mamute ---
[INFO] 
[INFO] --- grunt-maven-plugin:1.4.1:npm (default) @ mamute ---
[INFO] OS Name: Linux
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 28.355s
[INFO] Finished at: Fri Jul 17 13:55:30 EDT 2015
[INFO] Final Memory: 60M/696M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal pl.allegro:grunt-maven-plugin:1.4.1:npm (default) on project mamute: Unable to execute mojo: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal pl.allegro:grunt-maven-plugin:1.4.1:npm (default) on project mamute: Unable to execute mojo
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to execute mojo
    at org.twdata.maven.mojoexecutor.MojoExecutor.executeMojoImpl(MojoExecutor.java:174)
    at org.twdata.maven.mojoexecutor.MojoExecutor$ExecutionEnvironmentM3.executeMojo(MojoExecutor.java:476)
    at org.twdata.maven.mojoexecutor.MojoExecutor.executeMojo(MojoExecutor.java:75)
    at pl.allegro.tdr.gruntmaven.AbstractExecutableMojo.runExecutable(AbstractExecutableMojo.java:97)
    at pl.allegro.tdr.gruntmaven.AbstractExecutableMojo.executeInternal(AbstractExecutableMojo.java:86)
    at pl.allegro.tdr.gruntmaven.BaseMavenGruntMojo.execute(BaseMavenGruntMojo.java:93)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 19 more
Caused by: org.apache.maven.plugin.MojoExecutionException: Command execution failed.
    at org.codehaus.mojo.exec.ExecMojo.execute(ExecMojo.java:362)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.twdata.maven.mojoexecutor.MojoExecutor.executeMojoImpl(MojoExecutor.java:172)
    ... 26 more
Caused by: org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
    at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:377)
    at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:160)
    at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:610)
    at org.codehaus.mojo.exec.ExecMojo.execute(ExecMojo.java:352)

the other question said that grunt needed to be installed, I entered the following as per the readme:

npm install

and that was ok. I also had some mysql errors which I resolved. Here is the pom.xml section:

            <plugin>
                <groupId>pl.allegro</groupId>
                <artifactId>grunt-maven-plugin</artifactId>
                <version>1.4.1</version>
                <configuration>
                    <gruntExecutable>node_modules/grunt-cli/bin/grunt</gruntExecutable>
                    <gruntOptions>
                        <gruntOption>--verbose</gruntOption>
                    </gruntOptions>
                    <target>${mamute.grunt.task}</target>
                </configuration>
                <executions>
                    <execution>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>npm</goal>
                            <goal>grunt</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

Edit

Have tried running the mvn-package.sh script, and installing grunt and grunt-cli globally as


sudo npm install -g grunt
sudo npm install -g grunt-cli

There was no message, error or confirmation after the install. Have tried that a number of times. jason

  • Check if you have grunt installed globally.

    Leonardo Wolter   Jul 17th 2015
  • If you're running debian, try installing nodejs-legacy. I ran into the same problem, and it seems to be because grunt relies on there being an executable called "node" while more recent nodejs packages have renamed this executable to "nodejs"

    coyler   Jul 18th 2015
  • SCHWEEET!!!! That did it. Maybe if you post that as an answer, I can set as accepted solution?

    Jason   Jul 18th 2015
  • It would be nice, can you do it @coyler?

    Leonardo Wolter   Jul 18th 2015
  1. You will see these arrows in every question page. They allow you to upvote/downvote according to the relevancy of the question/answer.
  2. Edit your question/answer if you wish to change it or update it.
  3. If you dont understand something about the question, leave a comment asking. The answer field should be only used for answers.
  4. If the author of a question mark an answer as solution, this mark will be visible.
  5. Click here to see more details about the operation of the system!

2 answers

It is not the answer you were looking for? Search other questions with the tags grunt or make your own question.