Skip Navigation
Show nav
Heroku Dev Center Dev Center
  • Get Started
  • Documentation
  • Changelog
  • Search
Heroku Dev Center Dev Center
  • Get Started
    • Node.js
    • Ruby on Rails
    • Ruby
    • Python
    • Java
    • PHP
    • Go
    • Scala
    • Clojure
    • .NET
  • Documentation
  • Changelog
  • More
    Additional Resources
    • Home
    • Elements
    • Products
    • Pricing
    • Careers
    • Help
    • Status
    • Events
    • Podcasts
    • Compliance Center
    Heroku Blog

    Heroku Blog

    Find out what's new with Heroku on our blog.

    Visit Blog
  • Log in or Sign up
View categories

Categories

  • Heroku Architecture
    • Compute (Dynos)
      • Dyno Management
      • Dyno Concepts
      • Dyno Behavior
      • Dyno Reference
      • Dyno Troubleshooting
    • Stacks (operating system images)
    • Networking & DNS
    • Platform Policies
    • Platform Principles
    • Buildpacks
  • Developer Tools
    • AI Tools
    • Command Line
    • Heroku VS Code Extension
  • Deployment
    • Deploying with Git
    • Deploying with Docker
    • Deployment Integrations
  • Continuous Delivery & Integration (Heroku Flow)
    • Continuous Integration
  • Language Support
    • Node.js
      • Working with Node.js
      • Troubleshooting Node.js Apps
      • Node.js Behavior in Heroku
    • Ruby
      • Rails Support
        • Working with Rails
      • Working with Bundler
      • Working with Ruby
      • Ruby Behavior in Heroku
      • Troubleshooting Ruby Apps
    • Python
      • Working with Python
      • Background Jobs in Python
      • Python Behavior in Heroku
      • Working with Django
    • Java
      • Java Behavior in Heroku
      • Working with Java
      • Working with Maven
      • Working with Spring Boot
      • Troubleshooting Java Apps
    • PHP
      • Working with PHP
      • PHP Behavior in Heroku
    • Go
      • Go Dependency Management
    • Scala
    • Clojure
    • .NET
      • Working with .NET
  • Databases & Data Management
    • Heroku Postgres
      • Postgres Basics
      • Postgres Getting Started
      • Postgres Performance
      • Postgres Data Transfer & Preservation
      • Postgres Availability
      • Postgres Special Topics
      • Migrating to Heroku Postgres
    • Heroku Key-Value Store
    • Apache Kafka on Heroku
    • Other Data Stores
  • AI
    • Inference Essentials
    • Inference API
    • Inference Quick Start Guides
    • AI Models
    • Tool Use
    • AI Integrations
    • Vector Database
  • Monitoring & Metrics
    • Logging
  • App Performance
  • Add-ons
    • All Add-ons
  • Collaboration
  • Security
    • App Security
    • Identities & Authentication
      • Single Sign-on (SSO)
    • Private Spaces
      • Infrastructure Networking
    • Compliance
  • Heroku Enterprise
    • Enterprise Accounts
    • Enterprise Teams
  • Patterns & Best Practices
  • Extending Heroku
    • Platform API
    • App Webhooks
    • Heroku Labs
    • Building Add-ons
      • Add-on Development Tasks
      • Add-on APIs
      • Add-on Guidelines & Requirements
    • Building CLI Plugins
    • Developing Buildpacks
    • Dev Center
  • Accounts & Billing
  • Troubleshooting & Support
  • Integrating with Salesforce
    • Heroku AppLink
      • Getting Started with Heroku AppLink
      • Working with Heroku AppLink
      • Heroku AppLink Reference
    • Heroku Connect (Salesforce sync)
      • Heroku Connect Administration
      • Heroku Connect Reference
      • Heroku Connect Troubleshooting
    • Other Salesforce Integrations
  • Language Support
  • Scala
  • Deploying Scala Apps on Heroku

Deploying Scala Apps on Heroku

English — 日本語に切り替える

Table of Contents [expand]

  • Prerequisites
  • Overview
  • Set Up the sbt-native-packager Plugin
  • Specifying a Java Version
  • The Procfile
  • Exclude Build Artifacts from Git
  • Customize the Build
  • Build and Run Locally
  • Deploy to Heroku
  • Console
  • Troubleshooting

Last updated February 26, 2026

This guide walks you through deploying an existing Scala app to Heroku.

If you’re new to Heroku, start with the Getting Started with Scala on Heroku tutorial.

Prerequisites

Install Scala, sbt, and the Heroku CLI before proceeding. This guide assumes you have an existing Scala app that builds with sbt.

Overview

Heroku Scala Support describes how Heroku recognizes a Scala application.

Your application must include a project/build.properties file that defines the sbt version it uses:

sbt.version=1.10.7

For more information, see Build behavior.

Set Up the sbt-native-packager Plugin

To package your app for deployment, use the sbt-native-packager sbt plugin. If you’re using the Play framework, this plugin is automatically configured for you.

If you’re not using Play framework, configure the plugin manually. Add the following to your project/plugins.sbt file:

addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.11.7")

Then enable the plugin in your build.sbt, for example JavaAppPackaging:

enablePlugins(JavaAppPackaging)

For more detailed information, see the sbt documentation and the sbt-native-packager documentation.

Specifying a Java Version

We recommend specifying a Java version for your app to ensure consistent builds. For more information, see Specifying a Java version.

The Procfile

A Procfile is a text file in the root directory of your application that defines process types and explicitly declares what command to run to start your app. If you use sbt-native-packager with the JavaAppPackaging archetype, you get a start script in target/universal/stage/bin. Your Procfile looks something like this, replacing hello with your app’s name:

web: target/universal/stage/bin/hello

This declares a single process type, web, and the command needed to run it. The name web attaches this process type to the HTTP routing stack of Heroku so it receives web traffic when deployed.

The command in a web process type must bind to the port number specified in the PORT environment variable. If it doesn’t, the dyno fails to start.

Exclude Build Artifacts from Git

Prevent build artifacts from going into revision control by creating a .gitignore file:

target/
project/boot

Customize the Build

By default, the buildpack runs compile stage as the sbt tasks during deployment. Customize this with the SBT_TASKS config var:

$ heroku config:set SBT_TASKS="compile stage dist" --app example-app

For multi-project sbt builds, set SBT_PROJECT to specify which project to build:

$ heroku config:set SBT_PROJECT=mySubProject --app example-app

Build and Run Locally

Build your app locally and start it:

$ sbt compile stage
$ heroku local --port 5001

Your app is now running on http://localhost:5001/.

Deploy to Heroku

Commit your changes to git and deploy your app:

$ git add .
$ git commit -m "Added a Procfile and packaging."
$ heroku login
...
$ heroku create
Creating app... done, stack is heroku-24
https://warm-frost-1289.herokuapp.com/ | https://git.heroku.com/warm-frost-1289.git
Git remote heroku added
$ git push heroku main
...
-----> Scala app detected

To open the app in your browser, run heroku open.

Console

Heroku allows you to run one-off dynos using the heroku run command. Use this to launch a REPL process attached to your local terminal for experimenting in your app’s environment:

$ heroku run sbt console
Running sbt console attached to terminal... up, run.1
...
scala>

For more information, see Running a Remote sbt Console for a Scala or Play Application.

Troubleshooting

Major releases of sbt may not be compatible with each other. Most issues will be related to mismatched versions of sbt.

Feedback

Log in to submit feedback.

Information & Support

  • Getting Started
  • Documentation
  • Changelog
  • Compliance Center
  • Training & Education
  • Blog
  • Support Channels
  • Status

Language Reference

  • Node.js
  • Ruby
  • Java
  • PHP
  • Python
  • Go
  • Scala
  • Clojure
  • .NET

Other Resources

  • Careers
  • Elements
  • Products
  • Pricing
  • RSS
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku Blog
    • Heroku News Blog
    • Heroku Engineering Blog
  • Twitter
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku
    • Heroku Status
  • Github
  • LinkedIn
  • © 2026 Salesforce, Inc. All rights reserved. Various trademarks held by their respective owners. Salesforce Tower, 415 Mission Street, 3rd Floor, San Francisco, CA 94105, United States
  • heroku.com
  • Legal
  • Terms of Service
  • Privacy Information
  • Responsible Disclosure
  • Trust
  • Contact
  • Cookie Preferences
  • Your Privacy Choices