Skip to content

NPE in spring-boot-maven-plugin:build-image when setting custom builder that is not a builder #22179

@jcfandino

Description

@jcfandino

When I try to set a custom builder in the maven plugin by following the documentation:
https://docs.spring.io/spring-boot/docs/current/maven-plugin/reference/html/#build-image-example-custom-image-builder

Like this:

      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <configuration>
          <image>
            <builder>gcr.io/paketo-buildpacks/bellsoft-liberica</builder>
          </image>
        </configuration>
      </plugin>

Running ./mvnw spring-boot:build-image fails with the following exception:

Caused by: java.lang.NullPointerException
    at org.springframework.boot.buildpack.platform.docker.type.ImageConfig.parseConfigEnv (ImageConfig.java:52)
    at org.springframework.boot.buildpack.platform.docker.type.ImageConfig.<init> (ImageConfig.java:46)
    at org.springframework.boot.buildpack.platform.docker.type.Image.<init> (Image.java:51)
    at org.springframework.boot.buildpack.platform.json.MappedObject.of (MappedObject.java:148)
    at org.springframework.boot.buildpack.platform.json.MappedObject.of (MappedObject.java:131)
    at org.springframework.boot.buildpack.platform.docker.type.Image.of (Image.java:111)
    at org.springframework.boot.buildpack.platform.docker.DockerApi$ImageApi.pull (DockerApi.java:163)
    at org.springframework.boot.buildpack.platform.build.Builder.pullBuilder (Builder.java:85)
    at org.springframework.boot.buildpack.platform.build.Builder.build (Builder.java:63)
    at org.springframework.boot.maven.BuildImageMojo.buildImage (BuildImageMojo.java:136)
    at org.springframework.boot.maven.BuildImageMojo.execute (BuildImageMojo.java:128)

I made this project to reproduce the error: https://github.com/jcfandino/spring-boot-npe
You can look at the build pipeline to see the error: https://github.com/jcfandino/spring-boot-npe/actions

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions