Skip to content
This repository has been archived by the owner on Nov 18, 2019. It is now read-only.

Development: Local workstation setup

bigpopakap edited this page Apr 6, 2013 · 21 revisions

Local workstation setup page

About this page

This document describes how to set up your local workstation: become a collaborator, set up your environment, check out the code and configure git, run/debug and edit the app. For information about submitting code, see Development: Branches, environments, and check ins

Create your developer accounts

Create a Github account

If you do not have one already, sign up for an account on Github

Create a Google account

Optionally, you can create a Google account to be added to the Google group.

Become a collaborator online

Ask to be added as a collaborator on Github, and optionally ask to be added to the Google group.

Install local programs

Install the Java runtime environment

Install Java, making sure to get the version specified in the system.properties file. This ensures that your version of Java matches other developers' versions, and what will be used when the app is run on Heroku

Install the Play! framework

Install the Play! framework, making sure to get the version specified in the dependencies.yml file. This ensures that your version of Java matches other developers' versions, and what will be used when the app is run on Heroku
If you're not familiar with Play, you can read the documentation here

Install the Heroku toolbelt

Install the Heroku toolbelt, which has the Heroku command line client (CLI), Foreman, and Git. You can always use Google to learn more about these tools

Install an IDE

If you want, install your favorite IDE. Which is probably Eclipse

Install EGit plugin for your IDE

Installing a Git plugin for your IDE will ensure that moving Java classes between packages will count as a file rename, rather than a delete and create.

To install the EGit plugin for Eclipse, see here

Add --no-ff as default option to merges into master. Window > Preferences > Team > Git > Configuration. Add a new key="merge.ff" value="false"

Check out code

Find a directory where you would like the project to reside. Clone into the repository in that location. This will create a subdirectory under your current directory.

Configure Git config

From the terminal, change directory into a valid git repository, and run the following commands to set up Git to know your identity:
git config --global user.name "johndoe305" (use your Github username here)
git config --global user.email johndoe@example.com

Import the development repo as a project in your IDE

From a terminal, change directories to the development repo that you cloned. Follow the instructions here to have Play generate the .project file that Eclipse requires, and import the project into Eclipse.
Important: make sure not to copy the project into your Eclipse workspace, so that edits to the source files will happen in the git repo itself.

Directory structure

You can read about the directory structure of a Play application here

Running/debugging in Eclipse

Launch the app by running the class MainApp as a Java Application. To run tests, run the main class MainTest

Once the launch is running, the console will have a line as follows:
Listening for transport dt_socket at address: 9999
Note the port listed there. It should match the JPDA_PORT environment variable.

  1. In Eclipse, create a new Debug Configuration (Right click on the project, "Debug As", "Debug Configurations...")
  2. Select "Remote Java Application"
  3. Enter "localhost" for the host, and "9999" (or whatever port you saw in step 3) as the port
  4. Make sure to check "Allow termination of JVM" to allow Eclipse to terminate that JVM. Otherwise, there is no way to stop the app except killing the process from the OS
  5. Click Debug
    This configuration will be saved for later, and will work as long as the JPDA port does not change. Eclipse has now been attached to the running process, and you can set breakpoints whatttuuppp!

Important: To stop the app, stopping the run started by a main class will not work. You must stop the run created by the remote debugging to stop the app (as long as you completed step 4 above)