Heroku Play Framework Support

Last Updated: 23 June 2015

cedar java play scala

Table of Contents

The Heroku Cedar stack natively supports both Play framework 1.x and 2.x applications.

This document describes the general behavior of the Heroku Cedar stack as it relates to the recognition and execution of Play framework applications. Play framework applications written in either Java or Scala can be run on Heroku.

For framework specific tutorials visit:


Heroku Play framework support will be applied to applications that match: */conf/application.conf in any directory except for the modules directory

When a deployed application is recognized as a Play application, Heroku responds -----> Play! app detected for Play 1.2.x apps, -----> Play 2.x - Java app detected for Play 2.x Java apps, or -----> Play 2.x - Scala app detected for Play 2.x Scala apps. Play 2.x language detection is based on file count and is for informational purposes only.

$ git push heroku master
-----> Play! app detected

Build behavior

Play 1.x

During the build phase of your application the following commands are run:

play dependencies --forProd --forceCopy --silent
play precompile --silent

Play 2.x

Play 2.x uses sbt to build your application behind the scenes. On Heroku sbt will be called directly to build your app:

sbt compile stage

The following directories are dropped from the slug after compilation, as they are not required at runtime:

  • Ivy cache (persisted between builds of the same app)
  • project/boot
  • target/scala-*
  • target/streams
  • target/resolution-cache


The following environment variables will be set at first push:

Play 1.2.x

  • PATH: .play:.tools:/usr/local/bin:/usr/bin:/bin
  • JAVA_OPTS: -Xmx384m -Xss512k -XX:+UseCompressedOops
  • PLAY_OPTS: --%prod -Dprecompiled=true
  • PORT: HTTP port to which the web process should bind
  • DATABASE_URL: URL of the database connection

Play 2.x

  • JAVA_OPTS: -XX:+UseCompressedOops
  • DATABASE_URL: URL of the database connection

Runtime behavior

Heroku currently uses OpenJDK to run your application. OpenJDK 8 is the default, while versions 6 and 7 are available using a system.properties file. See the Java Tutorials for more information.

Play 1.2.x

The default web process definition is:

web: play run --http.port=\$PORT \$PLAY_OPTS

Play 2.0.x-2.1.x

A start script is generated by the xbst-start-script-plugin. This start script is used by the default web process definition:

web: target/start -Dhttp.port=$PORT $JAVA_OPTS

Play 2.2+

The default web process is determined by examining output from the native packager plugin. If your app only contains one process, the following default web process is generated:

web: target/universal/stage/bin/{your project name} -Dhttp.port=$PORT

Note: JAVA_OPTS is read by the generated script and does not need to be passed into the process.

Supported versions

Play 1.2.x

  • 1.2.3
  • 1.2.4
  • 1.2.5
  • 1.2.6
  • 1.2.7
  • 1.3.0
  • 1.3.1 (default)

Play 2.x

Play 2.x relies on sbt dependency resolution so all versions are available as soon as they are released.


A Postgres database is automatically provisioned for Play framework applications. This populates the DATABASE_URL environment variable.

Further Reading