title: How to use maven-exec-plugin for npm clean?
body: <p>I am using exec-maven-plugin. I have extensions for npm install and npm clean. Below is my plugin section in the pom file. It contains extension for npm install , tsc run and npm clean. </p>
  
  <pre><code>&lt;plugin&gt;
      &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
      &lt;artifactId&gt;exec-maven-plugin&lt;/artifactId&gt;
      &lt;version&gt;1.6.0&lt;/version&gt;
      &lt;executions&gt;
  
        &lt;execution&gt;
          &lt;id&gt;npm run clean (clean)&lt;/id&gt;
          &lt;goals&gt;
            &lt;goal&gt;exec&lt;/goal&gt;
          &lt;/goals&gt;
          &lt;phase&gt;clean&lt;/phase&gt;
          &lt;configuration&gt;
            &lt;workingDirectory&gt;./src/&lt;/workingDirectory&gt;
            &lt;executable&gt;npm&lt;/executable&gt;
            &lt;arguments&gt;
              &lt;argument&gt;clean&lt;/argument&gt;
            &lt;/arguments&gt;
          &lt;/configuration&gt;
        &lt;/execution&gt;
  
      &lt;/executions&gt;
    &lt;/plugin&gt;
  </code></pre>
  
  <p>But when I do maven-package it gives below error:</p>
  
  <pre><code>Usage: npm &lt;command&gt;
  
  where &lt;command&gt; is one of:
      access, adduser, audit, bin, bugs, c, cache, ci, cit,
      clean-install, clean-install-test, completion, config,
      create, ddp, dedupe, deprecate, dist-tag, docs, doctor,
      edit, explore, get, help, help-search, hook, i, init,
      install, install-ci-test, install-test, it, link, list, ln,
      login, logout, ls, org, outdated, owner, pack, ping, prefix,
      profile, prune, publish, rb, rebuild, repo, restart, root,
      run, run-script, s, se, search, set, shrinkwrap, star,
      stars, start, stop, t, team, test, token, tst, un,
      uninstall, unpublish, unstar, up, update, v, version, view,
      whoami
  
  npm &lt;command&gt; -h  quick help on &lt;command&gt;
  npm -l            display full usage info
  npm help &lt;term&gt;   search for help on &lt;term&gt;
  npm help npm      involved overview
  
  Specify configs in the ini-formatted file:
      /home/user/.npmrc
  or on the command line via: npm &lt;command&gt; --key value
  Config info can be viewed via: npm help config
  
  npm@6.10.2 /usr/lib/node_modules/npm
  
  [ERROR] Command execution failed.
  org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
      at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
  
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD FAILURE
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: 0.541 s
  [INFO] Finished at: 2019-09-25T11:47:14+02:00
  [INFO] Final Memory: 8M/40M
  [INFO] ------------------------------------------------------------------------
  [ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:exec (npm run clean (clean)) on project
  </code></pre>
  
  <p>Can somebody please help me on this?</p>
  
  <p>Thanks in advance.</p>