docs community blog github
Edit

Java Buildpack Reference

This reference documentation offers an in-depth description of the behavior and configuration options of the Paketo Java Buildpack. For explanations of how to use the buildpack for several common use-cases, see the Paketo Java Buildpack How To documentation.

The Paketo Java Buildpack allows users to create an image containing a JVM application from a precompiled artifact or directly from source.

The Java Buildpack is a composite buildpack and each step in a build is handled by one of its components. For a full set of configuration options and capabilities see the homepages for the component buildpacks.

About the JVM

The Java Buildpack uses the BellSoft Liberica implementations of the JRE and JDK. JVM installation is handled by the BellSoft Liberica Buildpack. The JDK will be installed in the build container but only the JRE will be contributed to the application image.

See the homepage for the Bellsoft Liberica Buildpack for a full set of configuration options.

Memory Calculator

The Java Buildpack installs a component called the Memory Calculator which will configure JVM memory based on the resources available to the container at runtime. The calculated flags will be appended to JAVA_TOOL_OPTIONS.

Spring Boot Applications

If the application uses Spring Boot the Spring Boot Buildpack will enhance the resulting image by adding additional metadata to the image config, applying Boot-specific performance optimizations, and enabling runtime auto-configuration.

Additional Metadata

The Spring Boot Buildpack adds the following additional image labels:

  • org.opencontainers.image.title - set to the value of Implementation-Title from MANIFEST.MF.
  • org.opencontainers.image.version - set to the values of Implementation-Version from MANIFEST.MF.
  • org.springframework.boot.version - set to the value of Spring-Boot-Version from MANIFEST.MF.
  • org.springframework.cloud.dataflow.spring-configuration-metadata.json - containing [configuration metadata][spring boot configuration metadata].
  • org.springframework.cloud.dataflow.spring-configuration-metadata.json - containing dataflow-configuration-metadata.properties, if present.

In addition, the buildpack will add an entry with name dependencies to the Bill-of-Materials listing the application dependencies.

Optimizations

The Spring Boot Buildpack can apply domain-specific knowledge to optimize the performance of Spring Boot applications. For example, if the buildpack detects that the application is a reactive web application the thread count will be reduced to 50 from a default of 250.

Components

The following component buildpacks compose the Java Buildpack. Buildpacks are listed in the order they are executed.

Buildpack Required/Optional Responsibility
Paketo CA Certificates Buildpack Optional Adds CA certificates to the system truststore at build and runtime.
Paketo BellSoft Liberica Buildpack Required Provides the JDK and/or JRE.
Paketo Gradle Buildpack Optional Builds Gradle-based applications from source.
Paketo Leiningen Buildpack Optional Builds Leiningen-based applications from source.
Paketo Maven Buildpack Optional Builds Maven-based applications from source.
Paketo SBT Buildpack Optional Builds SBT-based applications from source.
Paketo Executable JAR Buildpack Optional Contributes a process Type that launches an executable JAR.
Paketo Apache Tomcat Buildpack Optional Contributes Apache Tomcat and a process type that launches a WAR with Tomcat.
Paketo DistZip Buildpack Optional Contributes a process type that launches a DistZip-style application.
Paketo Spring Boot Buildpack Optional Contributes configuration and metadata to Spring Boot applications.
Paketo Procfile Buildpack Optional Allows the application to define or redefine process types with a [Procfile][procfiles]
Paketo Azure Application Insights Buildpack Optional Contributes the Application Insights Agent and configures it to connect to the service.
Paketo Debug Buildpack Optional Configures debugging for JVM applications.
Paketo Google Stackdriver Buildpack Optional Contributes Stackdriver agents and configures them to connect to the service.
Paketo JMX Buildpack Optional Configures JMX for JVM applications.
Paketo Encrypt At Rest Buildpack Optional Encrypts an application layer and contributes a profile script that decrypts it at launch time.
Paketo Environment Variables Buildpack Optional Contributes arbitrary user-provided environment variables to the image.
Paketo Image Labels Buildpack Optional Contributes OCI-specific and arbitrary user-provided labels to the image.
Edit

Last modified: September 21, 2021