7
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Scala で Play Frameworkプロジェクトを作成する

Last updated at Posted at 2015-12-08

前提条件

  • OS : MacOS X
  • brewインストール済み
  • Scala : version 2.11.x

1. インストール

# brewのリポジトリ更新
$ brew update

# Play Framework インストール
$ brew install typesafe-activator

# インストール確認
$ which activator
/usr/local/bin/activator

2. プロジェクト作成

# 新しいアプリケーションを作成
# 適当なフォルダ<path>で作業を行う。
$ cd <path>
$ activator new play-hello-world play-scala

Fetching the latest list of templates...

OK, application "play-hello-world" is being created using the "play-scala" template.

To run "play-hello-world" from the command line, "cd play-hello-world" then:
/<path>/play-hello-world/activator run

To run the test for "play-hello-world" from the command line, "cd play-hello-world" then:
/<path>/play-hello-world/activator test

To run the Activator UI for "play-hello-world" from the command line, "cd play-hello-world" then:
/<path>/play-hello-world/activator ui

3. Activator コンソールに入る

# 作成されたプロジェクトフォルダに移動
$ cd play-hello-world/
# Activator コンソールに入る
$ activator
[info] Loading project definition from /<path>/play-hello-world/project
[info] Set current project to play-hello-world (in build file:/<path>/play-hello-world/)
[play-hello-world] $

4. アプリケーション実行

# アプリケーションを実行
[play-hello-world] $ run
[info] Updating {file:/<path>/play-hello-world/}root...
[info] Resolving jline#jline;2.12.1 ...
[info] Done updating.

--- (Running the application, auto-reloading is enabled) ---

[info] p.c.s.NettyServer - Listening for HTTP on /0:0:0:0:0:0:0:0:9000

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

5. 起動確認

プラウザで、http://localhost:9000/ にアクセス。
下の画面が表示されればOK。

Welcome_to_Play.png

まとめ

Scalaで、Play Frameworkを使ったWebアプリケーションの雛形までできました。
次は、IDEのIntelliJ IDEA 15 CEをインストールして、アプリケーションをプロジェクトとしてImportします。

< Prev Scala 2.11 で Hello World
Next > IntelliJ IDEA 15 にPlayFrameworkのプロジェクトをインポートする。

7
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?