Skip Navigation
Show nav
Heroku Dev Center
  • Get Started
  • Documentation
  • Changelog
  • Search
  • Get Started
    • Node.js
    • Ruby on Rails
    • Ruby
    • Python
    • Java
    • PHP
    • Go
    • Scala
    • Clojure
  • 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 inorSign up
View categories

Categories

  • Heroku Architecture
    • Dynos (app containers)
    • Stacks (operating system images)
    • Networking & DNS
    • Platform Policies
    • Platform Principles
  • Command Line
  • Deployment
    • Deploying with Git
    • Deploying with Docker
    • Deployment Integrations
  • Continuous Delivery
    • Continuous Integration
  • Language Support
    • Node.js
    • Ruby
      • Working with Bundler
      • Rails Support
    • Python
      • Background Jobs in Python
      • Working with Django
    • Java
      • Working with Maven
      • Java Database Operations
      • Working with the Play Framework
      • Working with Spring Boot
      • Java Advanced Topics
    • PHP
    • Go
      • Go Dependency Management
    • Scala
    • Clojure
  • Databases & Data Management
    • Heroku Postgres
      • Postgres Basics
      • Postgres Getting Started
      • Postgres Performance
      • Postgres Data Transfer & Preservation
      • Postgres Availability
      • Postgres Special Topics
    • Heroku Data For Redis
    • Apache Kafka on Heroku
    • Other Data Stores
  • Monitoring & Metrics
    • Logging
  • App Performance
  • Add-ons
    • All Add-ons
  • Collaboration
  • Security
    • App Security
    • Identities & Authentication
    • Compliance
  • Heroku Enterprise
    • Private Spaces
      • Infrastructure Networking
    • Enterprise Accounts
    • Enterprise Teams
    • Heroku Connect (Salesforce sync)
      • Heroku Connect Administration
      • Heroku Connect Reference
      • Heroku Connect Troubleshooting
    • Single Sign-on (SSO)
  • 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
  • Language Support
  • Clojure
  • Deploying Clojure Applications with the Heroku Leiningen Plugin

Deploying Clojure Applications with the Heroku Leiningen Plugin

English — 日本語に切り替える

Last updated September 17, 2020

Table of Contents

  • Adding the plugin
  • Deploying an app
  • Configuring the plugin
  • Requirements

The Heroku Leiningen Plugin is deprecated and no longer under active development.

Existing setups using this plugin will continue to work for the foreseeable future. However, we advise customers to migrate to another deployment mechanism since this plugin will not be updated to include security fixes, support for more recent Java/Clojure versions or new features. Customers that require deployment of pre-built uberjars can use the Heroku Java CLI plugin.

For more information about the deployment of Clojure applications on Heroku, see Deploying Clojure Apps on Heroku.

In addition to Git deployment, Heroku supports building and releasing apps via an API. The lein-heroku plugin uses this API to provide direct deployment of prepackaged standalone web applications to Heroku.

This may be a preferred approach for applications that take a long time to compile or need to be deployed from a continuous integration server such as Travis CI or Jenkins.

In this article, you’ll learn how to include the Heroku Leiningen Plugin in your project, configure it, and deploy your application to Heroku.

Adding the plugin

To include the plugin in your project, add the latest version of the Leiningen plugin to your project.clj file’s :plugins vector, for example:

[lein-heroku "0.5.3"]

Install the Heroku CLI and run the create command.

$ heroku create
Creating obscure-sierra-7788... done, stack is heroku-18
http://obscure-sierra-7788.herokuapp.com/ | git@heroku.com:obscure-sierra-7788.git

If you do not have a Heroku Git repo in your git remotes, add something like this to your project.clj .

:heroku {:app-name "your-heroku-app-name"}

Make sure your project has a Procfile, and you’re ready to deploy.

Deploying an app

Run the following command from the root directory of your project to deploy the app to Heroku:

$ lein heroku deploy
-----> Packaging application...
       - app: obscure-sierra-7788
       - including: target/clojure-getting-started-standalone.jar
-----> Creating build...
       - file: target/heroku/slug.tgz
       - size: 5MB
-----> Uploading build...
       - success
-----> Deploying...
remote:
remote: -----> Fetching custom tar buildpack... done
remote: -----> JVM Common app detected
remote: -----> Installing OpenJDK 1.8... done
remote: -----> Discovering process types
remote:        Procfile declares types -> web
remote:
remote: -----> Compressing... done, 53.9MB
remote: -----> Launching... done, v6
remote:        https://obscure-sierra-7788.herokuapp.com/ deployed to Heroku
remote:
-----> Done

Visit your application with this command:

$ heroku open -a obscure-sierra-7788

Or view the logs with this command:

$ heroku logs -a obscure-sierra-7788

The Heroku CLI will allow you to access the application, and run commands just like an application deployed with git push.

Configuring the plugin

You may set a :heroku element in your project.clj like this:

:heroku {
  :app-name "your-heroku-app-name"
  :jdk-version "1.8"
  :include-files ["target/myapp.jar"]
  :process-types { "web" "java -jar target/myapp.jar" }}

By default, the plugin will include the target directory in your slug file.

Requirements

  • Your application must be built as an uberjar.
  • You must use Java 1.7 or higher locally.

For more information on the plugin and Clojure in general, see Heroku’s Clojure support. For more information on Leiningen, see the Leiningen documentation.

Keep reading

  • Clojure

Feedback

Log in to submit feedback.

Using WebSockets on Heroku with Clojure and Immutant Deploying Clojure Apps on Heroku

Information & Support

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

Language Reference

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

Other Resources

  • Careers
  • Elements
  • Products
  • Pricing

Subscribe to our monthly newsletter

Your email address:

  • RSS
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku Blog
    • Heroku News Blog
    • Heroku Engineering Blog
  • Heroku Podcasts
  • Twitter
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku
    • Heroku Status
  • Facebook
  • Instagram
  • Github
  • LinkedIn
  • YouTube
Heroku is acompany

 © Salesforce.com

  • heroku.com
  • Terms of Service
  • Privacy
  • Cookies
  • Cookie Preferences