0

Having a Spring Boot app I tried to build it using the Paketo Buildpack

pack build my-app
    --builder paketobuildpacks/builder:base
    --env BP_JVM_VERSION=8

But it doesn't come with JDK, only JRE is available.

It comes a error

compiler is null maybe you are on JRE enviroment please change to JDK environment

How can i add jdk to my app image?

sia
  • 21
  • 5

1 Answers1

0

There was a deliberate decision made with the Paketo Java buildpacks to only install a JRE into the runtime container image. We install a JDK while your application is being built, but while the app runs only a JRE is available. This is for security, as a JDK provides a larger surface area as well as the tools an attacker would require to recompile code changes.

There are a couple of known cases where applications require a JDK though, so this has surfaced up as a feature request for the buildpacks. Most of the work has been done so we should have this capability merged in soon. Watch this issue for updates.

In the meantime, what you can do is to use the instructions for selecting an alternate JVM provider and select a JVM provider that does not ship with a JVM. Off the top of my head, that is Amazon Corretto and Microsoft OpenJDK.

When you pack build, you'll see a message indicating that the JDK was installed because a JRE was not available. You should then have a JDK available in your runtime container.

Daniel Mikusa
  • 13,716
  • 1
  • 22
  • 28