title: Using a jib for maven but non-Java application
body: <p>I am in the process of creating a project and use Jib to create containers and push them to ECR. It is a multi-module maven project which has 3 sub-modules, 2 of them are standard java spring-boot project which is woking fine with Jib and the other one is an npm project which build using mvn. Here is the pom for it.</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot;
      xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;artifactId&gt;my-search-frontend&lt;/artifactId&gt;
      &lt;packaging&gt;pom&lt;/packaging&gt;
      &lt;version&gt;1.11.0-SNAPSHOT&lt;/version&gt;
      &lt;name&gt;my search frontend&lt;/name&gt;
      &lt;description&gt;my search frontend&lt;/description&gt;
  
      &lt;parent&gt;
          &lt;artifactId&gt;my-search&lt;/artifactId&gt;
          &lt;groupId&gt;com.regalo.my&lt;/groupId&gt;
          &lt;version&gt;1.11.0-SNAPSHOT&lt;/version&gt;
      &lt;/parent&gt;
  
      &lt;build&gt;
          &lt;finalName&gt;my-search-frontend&lt;/finalName&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;artifactId&gt;maven-clean-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.0.0&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;filesets&gt;
                          &lt;fileset&gt;
                              &lt;directory&gt;node_modules&lt;/directory&gt;
                              &lt;includes&gt;
                                  &lt;include&gt;**/*&lt;/include&gt;
                              &lt;/includes&gt;
                              &lt;followSymlinks&gt;false&lt;/followSymlinks&gt;
                          &lt;/fileset&gt;
                          &lt;fileset&gt;
                              &lt;directory&gt;build&lt;/directory&gt;
                              &lt;includes&gt;
                                  &lt;include&gt;**/*&lt;/include&gt;
                              &lt;/includes&gt;
                              &lt;followSymlinks&gt;false&lt;/followSymlinks&gt;
                          &lt;/fileset&gt;
                      &lt;/filesets&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
              &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-install&lt;/id&gt;
                          &lt;phase&gt;initialize&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;install&lt;/argument&gt;
                              &lt;/arguments&gt;
                              &lt;workingDirectory&gt;${project.basedir}&lt;/workingDirectory&gt;
                          &lt;/configuration&gt;
                      &lt;/execution&gt;
                      &lt;execution&gt;
                          &lt;id&gt;npm-run-build&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;run&lt;/argument&gt;
                                  &lt;argument&gt;build&lt;/argument&gt;
                              &lt;/arguments&gt;
                              &lt;workingDirectory&gt;${project.basedir}&lt;/workingDirectory&gt;
                          &lt;/configuration&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;com.spotify&lt;/groupId&gt;
                  &lt;artifactId&gt;docker-maven-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;skipDocker&gt;${skip.docker}&lt;/skipDocker&gt;
                      &lt;imageTags&gt;
                          &lt;imageTag&gt;${project.version}&lt;/imageTag&gt;
                          &lt;imageTag&gt;latest&lt;/imageTag&gt;
                      &lt;/imageTags&gt;
                      &lt;dockerDirectory&gt;${project.basedir}/docker&lt;/dockerDirectory&gt;
                      &lt;resources&gt;
                          &lt;resource&gt;
                              &lt;targetPath&gt;/build&lt;/targetPath&gt;
                              &lt;directory&gt;${project.basedir}/build&lt;/directory&gt;
                              &lt;include&gt;**/*&lt;/include&gt;
                          &lt;/resource&gt;
                          &lt;resource&gt;
                              &lt;targetPath&gt;/build&lt;/targetPath&gt;
                              &lt;directory&gt;${project.basedir}&lt;/directory&gt;
                              &lt;includes&gt;
                                  &lt;include&gt;index.html&lt;/include&gt;
                              &lt;/includes&gt;
                          &lt;/resource&gt;
                      &lt;/resources&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-source-plugin&lt;/artifactId&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;com.google.cloud.tools&lt;/groupId&gt;
                  &lt;artifactId&gt;jib-maven-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;to&gt;
                          &lt;image&gt;${docker.repository.host}/${project.artifactId}:${project.version}&lt;/image&gt;
                      &lt;/to&gt;
                      &lt;!-- &lt;skip&gt;${skip.docker}&lt;/skip&gt; --&gt;
                      &lt;extraDirectories&gt;
                          &lt;paths&gt;
                              &lt;path&gt;
                                  &lt;from&gt;${project.basedir}&lt;/from&gt;
                                  &lt;into&gt;/build&lt;/into&gt;
                              &lt;/path&gt;
                          &lt;/paths&gt;
                      &lt;/extraDirectories&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  <p>Spotify one is the way previously we did it and now we are moving to Jib. But I am getting sollowing issue for this app build,</p>
  <pre><code>    [ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:2.7.1:build (default-cli) on project my-search-frontend: Obtaining project build output files failed; make sure you have compiled your project before trying to build the image. 
  (Did you accidentally run &quot;mvn clean jib:build&quot; instead of &quot;mvn clean compile jib:build&quot;?): /home/cyrex/Documents/Sourcecode/my-search/my-search-frontend/target/classes -&gt; [Help 1]
  </code></pre>
  <p>Project structure of app</p>
  <p><a href="https://i.stack.imgur.com/8J5nL.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8J5nL.jpg" alt="enter image description here" /></a></p>
  <p>Help on this would highly appreciate.</p>