This is the official Heroku buildpack for apps that use Maven as their build tool. It's primarily used to build Java applications, but it can also build applications written in other JVM languages.
If you're using a different JVM build tool, use the appropriate buildpack:
- Gradle buildpack for Gradle projects
- Scala buildpack for sbt projects
- Clojure buildpack for Leiningen projects
This buildpack officially supports Maven 3.x. Maven 4.x support will be added after its release.
See the Getting Started with Java on Heroku tutorial.
Your app requires a pom.xml file, or one of the other POM formats supported by the Maven Polyglot plugin, in the root directory.
Specify an OpenJDK version by creating a system.properties file in the root of your project directory and setting the java.runtime.version property. See the Java Support article for available versions and configuration instructions.
Specify a Maven version by adding the Maven Wrapper to your project. When this buildpack detects the presence of a mvnw script and a .mvn directory, it will run the Maven Wrapper instead of the default mvn command.
Alternatively, you can set the maven.version property in system.properties, though using the Maven Wrapper is the recommended approach.
Configure the buildpack by setting environment variables:
| Environment Variable | Description | Default |
|---|---|---|
MAVEN_CUSTOM_GOALS |
Maven goals to execute | clean dependency:list install |
MAVEN_CUSTOM_OPTS |
Maven command-line options | -DskipTests |
MAVEN_JAVA_OPTS |
JVM options for Maven execution | (none) |
MAVEN_SETTINGS_PATH |
Path to a custom settings.xml file |
(none) |
MAVEN_SETTINGS_URL |
URL from which to download a custom settings.xml file |
(none) |
MAVEN_HEROKU_CI_GOAL |
Maven goal for Heroku CI test runs | test |
For more information about using a custom Maven settings.xml file, see Using a Custom Maven Settings File.
For more information about using Java on Heroku, see the Java Support documentation on Dev Center.
