m_shige1979のときどきITブログ

プログラムの勉強をしながら学習したことや経験したことをぼそぼそと書いていきます

Github(変なおっさんの顔でるので気をつけてね)

https://github.com/mshige1979

scalaのフレームワークPlay2.2もインストール

前回は2.3なので

メモ代わりに2.2も実験

環境

vagrantのCentOS7.x

インストールするもの

Play2.2

手順

Playのダウンロード
$ wget https://downloads.typesafe.com/play/2.2.6/play-2.2.6.zip

https://www.playframework.com/download

解凍して配置
$ unzip play-2.2.6.zip
$ echo 'export PATH=$PATH:~/play-2' >>  ~/.bash_profile
$ source ~/.bash_profile
$ chmod a+x play-2
起動確認
$ which play
~/play-2/play
[vagrant@localhost ~]$ play help
Getting com.typesafe.play console_2.10 2.2.6 ...
:: retrieving :: org.scala-sbt#boot-app
	confs: [default]
	6 artifacts copied, 0 already retrieved (2012kB/69ms)
Getting Scala 2.10.3 (for console)...
:: retrieving :: org.scala-sbt#boot-scala
	confs: [default]
	5 artifacts copied, 0 already retrieved (24447kB/40ms)
       _
 _ __ | | __ _ _  _
| '_ \| |/ _' | || |
|  __/|_|\____|\__ /
|_|            |__/

play 2.2.6 built with Scala 2.10.3 (running Java 1.8.0_25), http://www.playframework.com
Welcome to Play 2.2.6!

These commands are available:
-----------------------------
license            Display licensing informations.
new [directory]    Create a new Play application in the specified directory.

You can also browse the complete documentation at http://www.playframework.com.

$

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

新規作成
$ play new myFirstApp
       _
 _ __ | | __ _ _  _
| '_ \| |/ _' | || |
|  __/|_|\____|\__ /
|_|            |__/

play 2.2.6 built with Scala 2.10.3 (running Java 1.8.0_25), http://www.playframework.com

The new application will be created in /home/vagrant/myFirstApp

What is the application name? [myFirstApp]
>

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 myFirstApp is created.

Have fun!

$
起動
$ cd myFirstApp/
$ play
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512M; support was removed in 8.0
Getting org.scala-sbt sbt 0.13.0 ...
:: retrieving :: org.scala-sbt#boot-app
	confs: [default]
	43 artifacts copied, 0 already retrieved (12440kB/109ms)
[info] Loading project definition from /home/vagrant/myFirstApp/project
[info] Set current project to myFirstApp (in build file:/home/vagrant/myFirstApp/)
       _
 _ __ | | __ _ _  _
| '_ \| |/ _' | || |
|  __/|_|\____|\__ /
|_|            |__/

play 2.2.6 built with Scala 2.10.3 (running Java 1.8.0_25), http://www.playframework.com

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

[myFirstApp] $ run
[info] Updating {file:/home/vagrant/myFirstApp/}myfirstapp...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.

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

[info] play - 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...)

結果

f:id:m_shige1979:20151102223647p:plain

今回はここまで