Java Builds

The Java buildpack detects if your build is Java by looking for a pom.xml file. If found, Maven will download all dependencies and build the project. For latest versions of Java, we will also look for a system.properties within the root as well.

Setting up your POM.XML file

If your app has any dependencies, the pom.xml file should include the maven-dependency-plugin.

It tells Maven to copy the jar files that your app depends on to the target/dependency directory.

Because we use Cloudnative Buildpacks, the pom.xml file needs to have a compatible structure to produce a correct build slug for Java.

Specify Java version

You can specify a Java version by adding a file called system.properties to your application.

Then set a java.runtime.version in the file:

Sample Java Procfile

Keep in mind, you must specify a PORT variable for the web process to expose the server to the internet.


Edit this file on GitHub