Heroku's official Cloud Native Buildpack for Apache Maven.
This buildpack is designed to work in conjunction with other Heroku buildpacks and cannot be used independently. If you
want to build a Java application, use the heroku/java
buildpack (Source,
Readme) which includes this Maven buildpack.
If the application does not contain Maven Wrapper, the buildpack will download Maven and install it in its own layer.
Users can specify the Maven version for their application by adding (or extending) a
Java properties file called system.properties
in the root directory of
the application.
The maven.version
key determines the Maven version that is installed. Currently, the only supported version is
3.9.4
. The default is 3.9.4
.
A Maven settings.xml
file defines values that configure Maven execution in various ways. Most commonly, it is used to
define a local repository location, alternate remote repository servers, and authentication information for private
repositories.
When a file named settings.xml
is present in the root directory of the application, the buildpack will automatically
use it to configure Maven at build time. The environment variable MAVEN_SETTINGS_PATH can be
used customize the file location.
In addition, the MAVEN_SETTINGS_URL environment variable can be used to instruct the buildpack
to download a settings.xml
file from a remote host via HTTPS.
By default, the Maven command used to build the application is mvn clean install -DskipTests
. Users can customize
this with the MAVEN_CUSTOM_GOALS and MAVEN_CUSTOM_OPTS environment
variables.
In addition, some extra configuration is used to ensure Maven stores the local repository in a dedicated layer.
This buildpack will create a target/mvn-dependency-list.log
in the application directory that can be used to later
determine which dependencies (including transitive ones) have been installed during the build.
For applications that use Spring Boot or Wildfly Swarm, this buildpack will generate a launch.toml
with a web
process
type to launch the application.
Requires either pom.xml
, pom.atom
, pom.clj
, pom.groovy
, pom.rb
, pom.scala
, pom.yaml
, or pom.yml
at the
root of the application source.
To compile Java sources a JDK is required. It can be provided by the heroku/jvm
(Source,
Readme) buildpack.
This is not a strict requirement of the buildpack. Requiring jvm-application
ensures that this Maven buildpack can be
used even when no other buildpack requires jvm-application.
Allows other buildpacks to depend on a compiled JVM application.
If you do not want the settings.xml
file in the root directory or if you intend to frequently change between different
setting configurations, you may prefer to put a settings file in a custom location. The buildpack provides this
capability with the MAVEN_SETTINGS_PATH
environment variable.
When the MAVEN_SETTINGS_URL
config variable is defined, the buildpack will download the file at the given location
and use it to configure Maven.
Allows overriding Maven options used during the build process. The default options are -DskipTests
.
Allows overriding the Maven goals used during the build process. The default goals are clean install
.
Allows overriding the Java options for the Maven process during build. The default Java options are -Xmx1024m
.
If set, the buildpack will emit debug log messages.
See LICENSE file.