allegro/grunt-maven-plugin

Issue running Grunt.js with Maven

dbclkclk opened this issue · 2 comments

Hey Guys:

Love the plugin with Maven. I am getting the following issues running maven install from STS (eclipse). Also my project is using Spring MVC.

     [ERROR] Failed to execute goal pl.allegro:grunt-maven-plugin:1.4.1:grunt (default) on project   cointraders-frontend: Unable to execute mojo: Command execution failed. Process exited with an  error: 3 (Exit value: 3) -> [Help 1]
     org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal pl.allegro:grunt-maven-plugin:1.4.1:grunt (default) on project cointraders-frontend: 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:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
  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: 3 (Exit value: 3)
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)
... 28 more
    [ERROR] 
   [ERROR] 
   [ERROR] For more information about the errors and possible solutions, please read the following articles:
   [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

My Grunt.js is as follows:

  module.exports = function(grunt){
     grunt.initConfig({
     /*   bgShell:{
      fail:true,
      npm_install:{
       cmd:'npm install'
       } ,
      bower_install:{
          cmd:'bower install'
       },
     },
  */
  karma: {
     web: {
        configFile:'karma/karma.conf.js'
      },
      web_ci:{
         options:{
         singleRun:true,
         watch:false
       },
       configFile:'karma/karma.conf.js'
     }
  },
 jshint: {
    all:{
       options: {
        jshintrc: true
     },
    files: {
      src: [
        'app/**/*.js','app/*.js',
        'controllers/**/*.js','controllers/*.js',
        'services/**/*.js','services/*.js',
        'directives/**/*.js','directives/*.js'
        ]
      }
    }
   },
 watch:{
   options:{
    atBegin:true
  },
  jshint:{
    files: [
        'app/**/*.js','app/*.js',0
        'controllers/**/*.js','controllers/*.js',
        'services/**/*.js','services/*.js',
        'directives/**/*.js','directives/*.js',
        'test/**/**/*.js', 'test/**/*.js','test/*.js'
      ],
    tasks:['jshint']
  }
 },
 concurrent:{
  options: {
    logConcurrentOutput: true
   },
   test:['karma:web','watch:jshint']
 },
  cssmin: {
   core: {
    expand: true,
    cwd: '../css/',
    src: ['*.css', '!*.min.css'],
    dest: 'mcss/dist',
    ext: '.min.css'
    }
  },
 uglify: {
  core: {
    options: {
      mangle: false
    },
    files: [{
      expand: true,
      src: [
        'app/**/*.js','app/*.js',
        'controllers/**/*.js','controllers/*.js',
        'services/**/*.js','services/*.js',
        'directives/**/*.js','directives/*.js'
        //,'test/**/**/*.js', 'test/**/*.js','test/*.js'
        ],
      dest: 'ujs/dist/',
      ext: '.min.js'
    }]
  }
  },
 concat:{
   js: {
    options: {
      // Replace all 'use strict' statements in the code with a single one at the top
      banner: "'use strict';\n",
      process: function(src, filepath) {
        return '// Source: ' + filepath + '\n' +
        src.replace(/(^|\n)[ \t]*('use strict'|"use strict");?\s*/g, '$1');
      },
    },
    src: ['ujs/dist/**/*.min.js'],
    dest: 'ujs/dist/index.min.js',
  },
  css: {
    src: ['mcss/dist/**/*.min.css'],
    dest: 'mcss/dist/app.min.css',
   },
 },
 lifecycle: {
  validate: [
  'jshint'
  ],
  test: [
  'bgShell:npm_install',
  'bgShell:bower_install',
  'karma:web_ci'
  ],
  package: [
  'cssmin',
  'uglify',
  'concat',
  ],
  }
 });
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-concurrent');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-build-lifecycle');
//grunt.loadNpmTasks('grunt-bg-shell');
grunt.registerTask('dev-test',['concurrent']);

}

Hi,

Did you run gruntfile via cli grunt, without maven plugin? Error code 3 you get points directly to grunt, it means that one of grunt tasks ended with error. Also, do you get same behavior when running maven from command line as opposed to STS?