February 25, 2013

MacにPlay frameworkをインストールしてみた

公式:
http://www.playframework.com/

ドキュメント:
http://www.playframework.com/documentation/2.1.0/Home

以下、2.1.0をインストールした際のコマンドをメモしておきます。

1. ダウンロード
$ cd /usr/local/
$ sudo mkdir play
$ cd play/
$ sudo wget http://downloads.typesafe.com/play/2.1.0/play-2.1.0.zip
$ sudo unzip play-2.1.0.zip
$ sudo ln -s play-2.1.0 latest
2. パスを通す
$ vim ~/.bash_profile
~/.bash_profileに追記。
export PATH="/usr/local/play/latest:$PATH"
反映。
$ source ~/.bash_profile
3. Scala applicationの作成
$ mkdir -p ~/play/apps
$ cd ~/play/apps/
$ sudo play new scala_app
What is the application name? [scala_app]
> name_of_scala_app

Which template do you want to use for this new application? 

  1             - Create a simple Scala application
  2             - Create a simple Java application

> 1
OK, application name_of_scala_app is created.

Have fun!

$ cd scala_app/
$ sudo play
[name_of_scala_app] $ run
http://localhost:9000/ にアクセスして確認。Ctrl+Dで終了。

4. Java applicationの作成
$ cd ~/play/apps/
$ sudo play new java_app
What is the application name? [java_app]
> name_of_java_app

Which template do you want to use for this new application? 

  1             - Create a simple Scala application
  2             - Create a simple Java application

> 2
OK, application name_of_java_app is created.

Have fun!
$ cd java_app/
$ sudo play
[name_of_java_app] $ run
http://localhost:9000/ にアクセスして確認。Ctrl+Dで終了。

No comments:

Post a Comment