title: Passing Working Directory to npm in exec-maven-plugin
body: <p>I am trying to run npm as part of my maven build. I am using exec-maven-plugin and here is my plugin section from pom.xml</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;executions&gt;
                  &lt;execution&gt;
                    &lt;id&gt;exec-npm-install&lt;/id&gt;
                    &lt;phase&gt;generate-sources&lt;/phase&gt;
  
                    &lt;goals&gt;
                      &lt;goal&gt;exec&lt;/goal&gt;
                    &lt;/goals&gt;
  
                    &lt;configuration&gt;
                      &lt;executable&gt;npm&lt;/executable&gt;
                      &lt;arguments&gt;
                        &lt;argument&gt;build&lt;/argument&gt;
                      &lt;/arguments&gt;
                      &lt;workingDirectory&gt;${basedir}/src/main/webapp&lt;/workingDirectory&gt;
                    &lt;/configuration&gt;
  
                  &lt;/execution&gt;
             &lt;/executions&gt;
          &lt;/plugin&gt;
  </code></pre>
  
  <p>How ever when i run mvn clean package or mvn generate-sources npm is not running.</p>
  
  <p>In my package.json i have the following scripts.</p>
  
  <pre><code>"scripts": {
      "start": "npm run build &amp;&amp; serve .",
      "build": "npm run build-js &amp;&amp; npm run build-css",
      "watch": "npm run watch-js &amp; npm run watch-css &amp; serve .",
      "watch-build": "npm run watch-js &amp;&amp; npm run watch-css &amp;&amp; npm run build-js &amp;&amp; npm run build-css &amp;&amp; serve .",
      "test": "npm run lint -s &amp;&amp; npm run build",
      "build-css": "rework-npm index.css | cleancss -o build/build.css",
      "build-js": "browserify --extension=.jsx --extension=.js src/app.jsx &gt; build/build.js",
      "watch-js": "watchify --extension=.jsx --extension=.js src/app.jsx -o build/build.js --debug --verbose",
      "watch-css": "nodemon -e css --ignore build/build.css --exec 'rework-npm index.css -o build/build.css'",
      "lint-eslint": "eslint .",
      "lint-jscs": "jscs .",
      "lint": "npm run lint-eslint &amp;&amp; npm run lint-jscs"
    }
  </code></pre>
  
  <p>And hence i am calling build.</p>
  
  <p>Earlier when i used npm install i did see the npm packages being installed.</p>
  
  <p>Also how do i specify the working directory for npm ?? </p>
  
  <p>I am passing using and that's where the package.json is located.</p>
  
  <pre><code>&lt;workingDirectory&gt;${basedir}/src/main/webapp&lt;/workingDirectory&gt;
  </code></pre>
  
  <p>Thanks</p>