Play framework 2.0 Finalが出たようです14 – 正式版リリース

2012.03.15

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

Playframework2.0 Finalとtypesafe stack 2.0のリリース

先日、ついにPlayframework2.0のRCがとれて正式版がリリースされました。
それにあわせて公式サイトも一新されました。
さらに、Typesafe stackもPlayframework 2.0対応してリリースされてます。

ダウンロード&インストール

ここからPlayframework2.0をダウンロードできます。
また、1.2x系もここからダウンロードできます。 安定度はまだ1.2系のほうが上なので、使用することもあると思います。
では2.0をダウンロードして解凍しましょう。

なお、今回使用した動作環境は以下のとおりです。

  • OS : MacOS X 10.7.2
  • Java : 1.6.0_26

解凍したディレクトリをPATHに追加すれば使用可能です。
※インストールにはJDK 6以降が必要です
参考:http://www.playframework.org/documentation/2.0/Installing

プロジェクト作成はいままでbetaやRCでやってきた方法と同じですが一応。
play new コマンドを使用してプロジェクトを作成します。

%play new helloworld                           
 _ __ | | __ _ _  _| |
| '_ \| |/ _' | || |_|
|  __/|_|\____|\__ (_)
|_|            |__/ 
             
play! 2.0, http://www.playframework.org

The new application will be created in /Users/path/sample/helloworld

What is the application name? 
> helloworld

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

  1 - Create a simple Scala application
  2 - Create a simple Java application
  3 - Create an empty project

> 1

OK, application helloworld is created.

Have fun!

プロジェクト名とプロジェクトのタイプを選択して作成します。いままでと同じですね。
プロジェクトを作成したらのそのディレクトリに移動してplayコンソールを起動(playコマンド)し、アプリケーションを起動(runコマンド)しましょう。

%cd helloworld/                                       
%play                               
[info] Loading project definition from /Users/path/samples/helloworld/project
[info] Set current project to helloworld (in build file:/Users/path/samples/helloworld/)
       _            _ 
 _ __ | | __ _ _  _| |
| '_ \| |/ _' | || |_|
|  __/|_|\____|\__ (_)
|_|            |__/ 
             
play! 2.0, http://www.playframework.org

> Type "help play" or "license" for more information.
> Type "exit" or use Ctrl+D to leave this console.

[helloworld] $ run

[info] Resolving org.hibernate.javax.persistence#hibernate-jpa-2.0-api;1.0.1.Fin                                                                                [info] Done updating.                                                        
--- (Running the application from SBT, auto-reloading is enabled) ---

[info] play - Listening for HTTP on port 9000...

(Server started, use Ctrl+D to stop and go back to the console...)

localhost:9000にブラウザでアクセスしてみてください。サンプルアプリのデフォルトページが表示されます。

まとめ

今回はPlayframework2.0のインストールと動作確認をしてみました。
今後もPlayframework2.0の紹介をしていきます。