title: skaffold: build image using local maven dependency
body: <p>I'm building my images using <code>pack</code> cli:</p>
  <pre><code>pack build fhir-mongo --builder paketobuildpacks/builder:base --path target/hes-mpi-fhir-mongodb-service-0.0.1-SNAPSHOT.jar
  </code></pre>
  <p>This is my project structure:</p>
  <pre><code>.
  ├── hes-mpi-fhir-mongodb
  │  ├── deployment.yaml
  │  ├── pom.xml
  │  ├── skaffold.yaml
  │  └──  src
  └── hes-spring-boot-core     &lt;&lt;&lt; dependency requiered by hes-mpi-fhir-mongodb
     ├── pom.xml
     └── src
  </code></pre>
  <p>As you can see, I managing two maven projects.</p>
  <p>My host building steps are:</p>
  <pre><code>$ hes-spring-boot-core &gt; mvn clean install
  $ hes-mpi-fhir-mongodb &gt; mvn clean package
  </code></pre>
  <p>I mean, I first install <code>hes-spring-boot-core</code> into local repository and then I build <code>hes-mpi-fhir-mongodb</code>:</p>
  <p>My <code>skaffold.yml</code> file is:</p>
  <pre class="lang-yaml prettyprint-override"><code>apiVersion: skaffold/v2beta26
  kind: Config
  metadata:
    name: hes-mpi-fhir-mongodb
  build:
    artifacts:
    - image: pom-xml-image
      buildpacks:
        builder: paketobuildpacks/builder:base
  profiles:
    - name: dev
      deploy:
        kustomize:
          paths: [&quot;kustomize/dev&quot;]
  </code></pre>
  <p>I'm getting this message, when I'm trying to build image:</p>
  <pre><code>...
  [builder] Running &quot;/layers/google.java.maven/maven/bin/mvn clean package --batch-mode -DskipTests -Dhttp.keepAlive=false --quiet&quot;
  [builder] [ERROR] Failed to execute goal on project hes-mpi-fhir-mongodb-service: Could not resolve dependencies for project cat.gencat.catsalut.hes.mpi.fhir:hes-mpi-fhir-mongodb-service:jar:0.0.1-SNAPSHOT: Could not find artifact cat.gencat.catsalut.hes:hes-spring-boot-core:jar:1.0.6 in central (https://repo.maven.apache.org/maven2)
  </code></pre>
  <p>It's getting me that maven builder is not able to find artifact <code>cat.gencat.catsalut.hes:hes-spring-boot-core:jar:1.0.6</code>.</p>
  <p>This error doesn't appear when I perform above <code>pack cli</code> command!</p>
  <p>How can I add this project as a dependency?</p>
  <p>I've took a look on documentation. There are some fields that are messing me:</p>
  <blockquote>
  <p><code>dependencies</code>:  file dependencies that skaffold should watch for both rebuilding and file syncing for this artifact.</p>
  </blockquote>
  <blockquote>
  <p>Artifact Dependency: You can define dependency on other artifacts using the requires keyword. This can be useful to specify another artifact image as the builder or runImage.</p>
  </blockquote>
  <p>I'm using skaffold <code>v1.35.1</code>.</p>
  <h3>Information</h3>
  <ul>
  <li>Skaffold version: 1.35.1</li>
  <li>Operating system: </li>
  <li>Installed via: skaffold.dev</li>
  <li>Contents of skaffold.yaml:</li>
  </ul>
  <pre class="lang-yaml prettyprint-override"><code>apiVersion: skaffold/v2beta26
  kind: Config
  metadata:
    name: hes-mpi-fhir-mongodb
  build:
    artifacts:
    - image: pom-xml-image
      context: target/hes-mpi-fhir-mongodb-service-0.0.1-SNAPSHOT.jar
      buildpacks:
        builder: paketobuildpacks/builder:base
        dependencies:
          paths:
            - &quot;target/hes-mpi-fhir-mongodb-service-0.0.1-SNAPSHOT.jar&quot;
      # requires:
      #   - image: core
  profiles:
    - name: dev
      deploy:
        kustomize:
          paths: [&quot;kustomize/dev&quot;]
  </code></pre>
  <p>Also I've tried to build two images. But problem arises.</p>
  <pre class="lang-yaml prettyprint-override"><code>apiVersion: skaffold/v2beta26
  kind: Config
  metadata:
    name: hes-mpi-fhir-mongodb
  build:
    artifacts:
    - image: core
      context: ../hes-spring-boot-core
      buildpacks:
        builder: paketobuildpacks/builder:base
        env:
          - &quot;BP_MAVEN_BUILD_ARGUMENTS=install&quot;
    - image: pom-xml-image
      # context: target/hes-mpi-fhir-mongodb-service-0.0.1-SNAPSHOT.jar
      buildpacks:
        builder: paketobuildpacks/builder:base
        dependencies:
          paths:
            - &quot;target/hes-mpi-fhir-mongodb-service-0.0.1-SNAPSHOT.jar&quot;
      requires:
        - image: core
  profiles:
    - name: dev
      deploy:
        kustomize:
          paths: [&quot;kustomize/dev&quot;]
  
  </code></pre>