Getting Started with Heroku & Eclipse

Last Updated: 23 February 2015

eclipse java

This article is a work in progress, or documents a feature that is not yet released to all users. This article is unlisted. Only those with the link can access it.

Table of Contents

This article only applies to applications in Heroku Enterprise for Java packages.

You can build/deploy and manage your Heroku applications right from within Eclipse using the Heroku Eclipse plugin. This article will guide you through installation, setup, create a new application or import an existing app and managing your application from Eclipse.


Installation and setup

  1. Open Eclipse and navigate to your project workspace.
  2. Go to Help > Install new Software
  3. Click Add to add the plugin update site
  4. Give the update site a name (e.g. Heroku) and enter for the Location and click Ok.
  5. Select the newly added update Site, select the checkbox against the “Heroku Eclipse Integration”
  6. Click Next two times
  7. Accept the MIT license and click Finish

API key setup

  1. Open Eclipse>Preferences
    If you know your API key, you can paste your API key directly into the API Key field.

Click Validate to validate your API key. You should see a Validation of your API key was successful! message at the top of the preferences window

  1. Select Heroku
  2. Enter Heroku username in Email field
  3. Enter your password in Password field
  4. Click Login. If your login was successful, your Heroku API key would be populated in the API Key field.

Create an SSH key

In order to deploy your code to Heroku, the plugin uses Git. The plugin depends on the eGit Eclipse plugin for all Git related tasks. An SSH key is required in order for eGit to communicate with Heroku. You will need to setup this the first time you build an app on Heroku. First you will need to generate a new SSH key. Follow the below steps to generate a new key

  1. Go to Eclipse>Preferences>General Network Connections>SSH2
  2. Choose the Key Management tab
  3. Click Generate RSA Key
  4. Click Save Private Key, accepting the defaults
  5. Click Ok

Adding your SSH key to Heroku

  1. Open Eclipse>Preferences
  2. Select Heroku
  3. In the SSH Key section, click Generate if you need to generate a new key. If you have previously generated & saved a SSH key is automatically loaded from the default location. If it is not in the default location, click Load SSH Key
  4. Click on Add to add your SSH Key to Heroku

Create app from template

  1. Open File > New > Other and expand the Heroku section create_app_1
  2. Select Create App from Template
  3. Pick a template from the list. Optionally you can also give your new application a name. If you do not give a name, Heroku will generate a unique name for your newly created application. create_app_2
  4. Click Finish to create a new application from the selected template. Once the application is created, the plugin will use eGit and pull down the source code repository as a local Git Repository.
    create_app_3 create_app_4

Importing an existing app into Eclipse

  1. Open File>Import and expand the Heroku section import_app_1
  2. Select Existing Heroku Application > Next
  3. Select the App that you want to import and click Next import_app_2
  4. The plugin will automatically try to detect the type of project (or Eclipse Nature) to apply. If you know the type of project, you can choose Import as General Project and apply the relevant nature once the import operation completes.
    If your project is a Java project using Maven, choose “Auto detected project”, and it will automatically apply the Maven nature and that will take care of setting up your project and build path etc. correctly.
  5. Click Finish to create a new application from the selected template. Once the application is created, the plugin will use eGit and pull down the source code repository as a local Git Repository. import_app_3

Deploying changes to Heroku

  1. Make the code changes and any other changes to your Eclipse project.
  2. Once you are ready to deploy these changes, right click on the project, and go to Team>Commit. Enter a commit message based on the changes you made. Ensure that any new files that you added to the project are selected. deploy_change_1
  3. Click Commit
  4. Right click the Project>Team>Push to Upstream
  5. Heroku will now receive your locally committed changes and the perform a build based on the type of app. If the build is successful, Heroku will then deploy the changes to your App on Heroku. You will see the build output from Heroku once the changes have been successfully pushed to Heroku. deploy_change_3

View all your Heroku apps

  1. Open Window>Show View>Other and expand the Heroku section.
  2. You will see a new View called My Heroku Apps open up that will list all your Apps associated with your Heroku account. You can sort by the application name by clicking on the “Name” header column.

Viewing your application info

  1. In the My Heroku Apps view you can either double-click on a specific app or, select App Info from the Right click context menu.
  2. Your application info will open in a new Eclipse Editor. App Info consist of 4 tabs:
Tab Description
Application Info Provides the name, web URL, git URL for the application
Collaborators Manage your collaborators for your App
Environment Variables Manage your App’s environment variables
Processes Manage your App’s processes (restart, scale & viewing logs)


Viewing application processes

  1. Heroku apps can support multiple processes that can be managed under that 1 app. To look at the state of the current processes, Double click on the Application in the My Heroku Apps view.
  2. Go to the Processes tab
  3. This table lists all “running” processeses with the following information
Field Description
Status If the processes is currently “running” it’ll display green, otherwise “red”.
Process name The name of the processes as specified in the Procfile
Dynos The current number of dynos executing the process
Command The command that Heroku uses to start the process


Viewing application logs

Note: If you want to toggle between logs for different applications,click on logs_icon icon and pick the application log you want to view.

  1. Right click on the Application in the My Heroku Apps view.
  2. Click on Logs view_logs

Scaling your app

Note: Your Heroku account needs to be “verified” in order to Scale your application. To verify your account, go to the My Account page and click Verify.

  1. You can run your application on multiple dynos with a click of a button. Right click on the Application in the My Heroku Apps view.
  2. Click on Scale
  3. Enter the name of the process you want to scale and the number of dynos you want to scale it to.
  4. Click on Ok to scale