画竜点睛を衝く@mapyo

日々やった事をつらつらと書くブログです

scalaとPlay Frameworkの環境構築

http://qiita.com/prinum/items/1fbefj6cf9641a4ec0a70

こちらを参考に進めた。 svmのインストール部分は普通に出来たが、 Play Frameworkのインストールはバージョンの関係でこの通りには出来なかった。

$ brew install play
Error: No available formula for play
Play 2.3 replaces the play command with activator:
  brew install typesafe-activator

You can read more about this change at:
http://www.playframework.com/documentation/2.3.x/Migration23
http://www.playframework.com/documentation/2.3.x/Highlights23

Play 2.3からは変わった模様。以下のコマンドで入れる。

$ brew install typesafe-activator

結構変わっているようなので、以下の本家のマニュアルを参考に進める。

http://www.playframework.com/documentation/2.3.x/PlayConsole

新しいアプリケーションの作成

$ activator new

# 途中、どのテンプレートを使う?か聞かれるが、迷わず4

Choose from these featured templates or enter a template name:
  1) minimal-java
  2) minimal-scala
  3) play-java
  4) play-scala
(hit tab to see a list of all templates)
> play-scala

# アプリケーション名を聞かれる
Enter a name for your application (just press enter for 'play-scala')
> test
OK, application "test" is being created using the "play-scala" template.
# 先ほど作成したテストプロジェクトに移動
$ cd test
$ activator

# かなり時間がかかるので覚悟。。。
# 途中でやめても一度実行されてものについては早い。

$ run

正常に起動すると、以下のURLで確認出来る。

http://localhost:9000/

所感

初回に、activatorして終わるまでがめちゃめちゃ時間かかってた。 その後のrunも多少時間がかかっていた。

2回目以降はすんなり実行出来たのでよかったー。コンパイルの関係なのかなぁ。という所です。 正直activatorに時間が掛かりすぎて、もやめようかと思ったりもしました。

というのを数日前に作成したっきり、ブログにアップするのを忘れていたので、アップしたのでした。

slacaでAndroidアプリもかけたりするので、意識が高まれば書いてみようかと思います。