title: exec-maven-plugin with npm install
body: <p>I try to use exec-maven-plugin in my project. </p>
  
  <p>Here is the code</p>
  
  <pre><code>            &lt;plugin&gt;
            &lt;artifactId&gt;exec-maven-plugin&lt;/artifactId&gt;
            &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
            &lt;version&gt;1.6.0&lt;/version&gt;
            &lt;executions&gt;
              &lt;execution&gt;
                &lt;id&gt;npm install&lt;/id&gt;
                &lt;goals&gt;
                  &lt;goal&gt;exec&lt;/goal&gt;
                &lt;/goals&gt;
                &lt;phase&gt;generate-resources&lt;/phase&gt;
                &lt;configuration&gt;
                  &lt;executable&gt;${node.directory}/${npm.executable}&lt;/executable&gt;
                  &lt;arguments&gt;
                    &lt;argument&gt;install&lt;/argument&gt;
                  &lt;/arguments&gt;
                  &lt;workingDirectory&gt;src/main/angular2/tourism&lt;/workingDirectory&gt;
                  &lt;target&gt;
                    &lt;echo message="Npm install" /&gt;
                  &lt;/target&gt;
                &lt;/configuration&gt;
              &lt;/execution&gt;
            &lt;/executions&gt;
          &lt;/plugin&gt;
  </code></pre>
  
  <p>Here is my directory structure
  <a href="https://i.stack.imgur.com/ZeVKN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZeVKN.png" alt="enter image description here"></a></p>
  
  <p>And the mentioned error is</p>
  
  <pre><code>/Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web/node/npm: line 34: node: command not found
  </code></pre>
  
  <p>Could you please help me</p>
  
  <p>I use know frontend-maven-plugin</p>
  
  <p>Here is the code </p>
  
  <pre><code>            &lt;plugin&gt;
              &lt;groupId&gt;com.github.eirslett&lt;/groupId&gt;
              &lt;artifactId&gt;frontend-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;1.6&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;workingDirectory&gt;src/main/angular5/tourism&lt;/workingDirectory&gt;
                  &lt;!-- where to install npm --&gt;
                  &lt;installDirectory&gt;src/main/angular5/tourisml&lt;/installDirectory&gt;
              &lt;/configuration&gt;                
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;id&gt;install node and npm&lt;/id&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;install-node-and-npm&lt;/goal&gt;
                      &lt;/goals&gt;
                      &lt;phase&gt;generate-resources&lt;/phase&gt;
                      &lt;configuration&gt;
                          &lt;nodeVersion&gt;v8.11.3&lt;/nodeVersion&gt;
                          &lt;npmVersion&gt;6.3.0&lt;/npmVersion&gt;                      
                      &lt;/configuration&gt;                        
                  &lt;/execution&gt;                  
                  &lt;execution&gt;
                          &lt;id&gt;npm install&lt;/id&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;npm&lt;/goal&gt;
                          &lt;/goals&gt;
                          &lt;!-- Optional configuration which provides for running any npm command --&gt;
                          &lt;configuration&gt;
                              &lt;arguments&gt;install&lt;/arguments&gt;
                              &lt;workingDirectory&gt;src/main/angular5/tourism&lt;/workingDirectory&gt;
                          &lt;/configuration&gt;
                   &lt;/execution&gt;
                   &lt;execution&gt;
                       &lt;id&gt;prod&lt;/id&gt;
                       &lt;goals&gt;
                         &lt;goal&gt;npm&lt;/goal&gt;
                       &lt;/goals&gt;
                       &lt;configuration&gt;
                         &lt;arguments&gt;run-script build&lt;/arguments&gt;
                         &lt;workingDirectory&gt;src/main/angular5/tourism&lt;/workingDirectory&gt;
                       &lt;/configuration&gt;
                       &lt;phase&gt;generate-resources&lt;/phase&gt;
                    &lt;/execution&gt;                                                      
              &lt;/executions&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt;
              &lt;configuration&gt;
                  &lt;finalName&gt;${project.artifactId}-${project.version}.zip&lt;/finalName&gt;
                  &lt;appendAssemblyId&gt;false&lt;/appendAssemblyId&gt;
              &lt;/configuration&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;id&gt;cfg-main-resources&lt;/id&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;single&lt;/goal&gt;
                      &lt;/goals&gt;
                      &lt;phase&gt;package&lt;/phase&gt;
                      &lt;configuration&gt;
                          &lt;descriptors&gt;
                              &lt;descriptor&gt;${basedir}/src/main/angular5/tourism/assembly.xml&lt;/descriptor&gt;
                          &lt;/descriptors&gt;
                      &lt;/configuration&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
  </code></pre>
  
  <p>And the assembly.xml file</p>
  
  <pre><code>&lt;assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd"&gt;
  &lt;id&gt;distribution&lt;/id&gt;
  &lt;formats&gt;
      &lt;format&gt;zip&lt;/format&gt;
  &lt;/formats&gt;
  
  &lt;includeBaseDirectory&gt;false&lt;/includeBaseDirectory&gt;
  
  &lt;fileSets&gt;
      &lt;fileSet&gt;
          &lt;outputDirectory&gt;statics&lt;/outputDirectory&gt;
          &lt;directory&gt;dist&lt;/directory&gt;
          &lt;includes&gt;
              &lt;include&gt;**/*&lt;/include&gt;
          &lt;/includes&gt;
      &lt;/fileSet&gt;
  &lt;/fileSets&gt;
  </code></pre>
  
  <p></p>
  
  <p>The objective is to prepare a zip file containing the compiled code to deploy it on server</p>
  
  <p>Here is the obtained directory structure</p>
  
  <p><a href="https://i.stack.imgur.com/XreL1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XreL1.png" alt="enter image description here"></a></p>
  
  <p>1) I don't understand why the dist folder does not contain the compiled code (I wonder furthermore what it must contain exactly)
  2) node and npm are installed in the directory tourisml/node, why
  3) there is an error stating that  </p>
  
  <pre><code>[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.4:single (cfg-main-resources) on project tourism-web: Failed to create assembly: Error creating assembly archive distribution: You must set at least one file. -&gt; [Help 1]
  org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.4:single (cfg-main-resources) on project tourism-web: Failed to create assembly: Error creating assembly archive distribution: You must set at least one file.
  </code></pre>
  
  <p>Normally I should obtaine one zip file (${project.artifactId}-${project.version}.zip) and I suppose it failed because there is no files in. Is that correct ?</p>