This needs to be configured on the Maven side of things to build a native image properly with the default buildpacks:

<image>
  <builder>paketobuildpacks/builder:tiny</builder>
  <env>
    <BP_NATIVE_IMAGE>true</BP_NATIVE_IMAGE>
   </env>
</image>

For Gradle, it is:

tasks.named('bootBuildImage') {
  builder = 'paketobuildpacks/builder:tiny'
  environment = ['BP_NATIVE_IMAGE': 'true']
}

Maven could define this when the native profile is enabled. For Gradle, it could react to the fact that the NBT plugin is applied. In both cases, we need to be cautious about the environment and how users can override it if they wish to do so.

Comment From: snicoll

The gradle side of things is tracked in #32768

Comment From: snicoll

The override of the ENV or the base image works as expected. Adding more entries in ENV does not remove the one from the parent.