Skip to content

Latest commit

 

History

History
87 lines (68 loc) · 7.72 KB

README.md

File metadata and controls

87 lines (68 loc) · 7.72 KB

Heroku Cloud Native Maven Buildpack

CI Registry

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.

How it works

Step 1: Download Maven

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.

Step 2: Resolve settings.xml

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.

Step 3: Run Maven build

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.

Step 4: Generate target/mvn-dependency-list.log

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.

Step 5: launch.toml

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.

Reference

Detect

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.

Build Plan

Requires

jdk

To compile Java sources a JDK is required. It can be provided by the heroku/jvm (Source, Readme) buildpack.

jvm-application

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.

Provides

jvm-application

Allows other buildpacks to depend on a compiled JVM application.

Environment Variables

MAVEN_SETTINGS_PATH

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.

MAVEN_SETTINGS_URL

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.

MAVEN_CUSTOM_OPTS

Allows overriding Maven options used during the build process. The default options are -DskipTests.

MAVEN_CUSTOM_GOALS

Allows overriding the Maven goals used during the build process. The default goals are clean install.

MAVEN_JAVA_OPTS

Allows overriding the Java options for the Maven process during build. The default Java options are -Xmx1024m.

HEROKU_BUILDPACK_DEBUG

If set, the buildpack will emit debug log messages.

License

See LICENSE file.