Error generating image using buildpacks for Spring boot app


I’m trying to deploy a Spring boot app. I don’t have a Dockerfile so I thought I’ll try out buildpacks to generate a Docker image and deploy it.

My fly.toml contains

  builder = "paketobuildpacks/builder:base"
  buildpacks = [""]

The rest is the basic generated content.
I don’t know if I should have used "" or "". I tried : couldn’t get them to work, but this is another topic.

So with this config I ran fly launch. At the application compiling stage, I’ve got this error:

Executing mvnw --batch-mode -Dmaven.test.skip=true --no-transfer-progress package
      /workspace/mvnw: 194: /workspace/mvnw: cannot open /workspace/.mvn/wrapper/ No such file

      Error: Could not find or load main class org.apache.maven.wrapper.MavenWrapperMain
      Caused by: java.lang.ClassNotFoundException: org.apache.maven.wrapper.MavenWrapperMain
unable to invoke layer creator
unable to contribute application layer
error running build
exit status 1
ERROR: failed to build: exit status 1
Error failed to fetch an image or build from source: executing lifecycle: failed with status code: 51

I executed the same mvnw command locally and it’s working fine.
I tried with option --local-only and --remote-only : same issue.

Any help would be appreciated :slight_smile:

Solved it : flyctl generated a .dockerignore, and the .mvn folder was in it so indeed it couldn’t find the mentioned file