Monday, August 12, 2013

How to create new play2 project in github


I have been really interested in scala during last year and it has been nice experience. Strong type checking and other scala features are awesome, but there are also some pitfalls to overcome. Scala syntax is not intuitive, specially if you come from imperative language background and some libraries are not mature as you wish. But this is another story.

In this article I will describe how to:
  1. create your first play project;
  2. open project under eclipse IDE;
  3. save project in local git repository;
  4. upload your local repository to github.
Actually it started from one project that I want to share with my college and we decided to use github as standard cloud repository for git project. We decided that public repository is not issue in our case, so lets start!

The simpliest way to start your first play project is from command line. Assumption is that scala, play2, jdk, eclipse are already installed in your system. In directory what you have choosen for project run

> play new stockTracker
creates new play project with default directory layout

> play eclipse
creates files to open porject in eclipse

Next open eclipse and File/Import General/Existing Project Into Workspace and select StockTracker directory. Now you have Eclipse porject in place and next is to add it to local git repository.

Right click project, Team/Share Project/Git, push Create button and enter StockTracker and push Finish. Now you should have something like C:\Users\jack\git\StockTracker\.git and press Finish.

Last step is to add your project to github. First create new ssh2 keypair (if you dont have it already) in Eclipse. Select in Eclipse Windows\Preferences General\Network Connection\SSH2 Key Management tab and generate and save your new private/public keys.

I assume you have already github account, so next step is to create new repository stockTracker. Press button "New repository", enter project name and press "Create repository". In github select Account Settings \ SSH keys and add your generated public key to github.

There is excellent video about same issue.


No comments:

Post a Comment