This repository is the home of Heroku Cloud Native Buildpacks for JVM applications. These buildpacks build Java, Scala and other JVM language application source code into application images with minimal configuration.
Important
This is a collection of Cloud Native Buildpacks, and is a component of the Heroku Cloud Native Buildpacks project, which is in preview. If you are instead looking for the Heroku Classic Buildpacks for JVM applications (for use on the Heroku platform), you may find them here: heroku/jvm, heroku/java, heroku/gradle, heroku/scala, heroku/clojure.
Note
Before getting started, ensure you have the pack
CLI installed. Installation instructions are available here.
To build a JVM application codebase into a production image:
$ cd ~/workdir/sample-jvm-app
$ pack build sample-app --builder heroku/builder:22
Then run the image:
docker run --rm -it -e "PORT=8080" -p 8080:8080 sample-app
Either a pom.xml
file (or one of the other POM formats supported by the
Maven Polyglot plugin) or a build.sbt
in the root
directory is required for these buildpacks to build your app.
A Procfile is a text file in the root directory of your application that defines process types and explicitly declares
what command should be executed to start your app. Your Procfile
will look something like this for Spring Boot:
web: java -Dserver.port=$PORT $JAVA_OPTS -jar target/demo-0.0.1-SNAPSHOT.jar
By default, the latest OpenJDK long-term support (LTS) release will be installed. You can configure the OpenJDK version your application needs. The buildpack tries to determine the required version in the following order:
You can specify a Java version by adding a Java properties file called
system.properties
to the root directory of your application. The value of the java.runtime.version
key specifies
the required OpenJDK version:
java.runtime.version=21
Supported major versions are 8
, 11
, 17
, 21
and 22
. The buildpack will always install the latest release
of the requested major version.
Language buildpacks are meta-buildpacks that aggregate other buildpacks (see below) for convenient use. Use these if you want to build your application.
ID | Name | Readme | Changelog |
---|---|---|---|
heroku/java |
Java | Readme | Changelog |
heroku/scala |
Scala | Readme | Changelog |
ID | Name | Readme | Changelog |
---|---|---|---|
heroku/maven |
Maven | Readme | Changelog |
heroku/gradle |
Gradle | Readme | Changelog |
heroku/sbt |
sbt | Readme | Changelog |
ID | Name | Readme | Changelog |
---|---|---|---|
heroku/jvm |
OpenJDK | Readme | Changelog |
Issues and pull requests are welcome. See our contributing guidelines if you would like to help.