PlayFramework/play2.3のインストール のバックアップソース(No.3)

更新

[[ソフトウェア/PlayFramework]]

#contents

* 概要 [#gbfcbc8c]

思った以上にいろいろ躓いたので。

* activator 同梱の play2.3 をダウンロード&解凍 [#geb1a993]

http://www.playframework-ja.org/download

の「オフライン版(342M)」から "typesafe-activator-1.2.2.zip" をダウンロード

 LANG:console
 > unzip typesafe-activator-1.2.2.zip
 > cd activator-1.2.2
 > activator.bat
  A Java JDK is not installed or can't be found.
  
  Please go to
    http://www.oracle.com/technetwork/java/javase/downloads/index.html
  and download a valid Java JDK and install before running Activator.
  
  If you think this message is in error, please check
  your environment variables to see if "java.exe" and "javac.exe" are
  available via JAVA_HOME or PATH.

* JDK8 をダウンロード&インストール [#m5d0958a]

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

から、"jdk-8u45-windows-x64.exe" をダウンロード&インストール。

 LANG:console
 > javac
  'javac' は、内部コマンドまたは外部コマンド、
  操作可能なプログラムまたはバッチ ファイルとして認識されていません。
 > "C:\Program Files\Develop\jdk1.8.0_45\bin"\javac
  使用方法: javac <options> <source files>
  使用可能なオプションには次のものがあります。
    -g                         すべてのデバッグ情報を生成する
    -g:none                    デバッグ情報を生成しない
    -g:{lines,vars,source}     いくつかのデバッグ情報のみを生成する
    ...

* 環境変数の設定 [#zba9786c]

 LANG:console
 > set JAVA_HOME="C:\Program Files\Develop\jdk1.8.0_45"
 > activator
  Files\Develop\jdk1.8.0_45""=="" の使い方が誤っています。

あれ?~
https://docs.oracle.com/cd/E19416-01/820-5482/inst_set_jdk_windows_t/

えーと・・・

 LANG:console
 > set JAVA_HOME=C:\Program Files\Develop\jdk1.8.0_45
 > activator
  コマンドの構文が誤っています。

そういうこと?!

どうやらこっちが正しそうだけれど、まだ動かない。

http://stackoverflow.com/questions/24116031/typesafe-activator-java-jdk-not-installed-or-cant-be-found

これか。

 LANG:console
 > set PATH=C:\Program Files\Develop\jdk1.8.0_45\bin;%PATH%
 > activator
  'findstr' は、内部コマンドまたは外部コマンド、
  操作可能なプログラムまたはバッチ ファイルとして認識されていません。
  コマンドの構文が誤っています。

ん???

なぜか PATH に Windows や Windows\System32 が含まれていなかった。

 LANG:console
 > set PATH=%PATH%;C:\Windows;C:\Windows\System32
 > activator
  Getting com.typesafe.activator activator-launcher 1.2.2 ...
  downloading file:////(activator_path)/repository/com.typesafe.activator/activator-launcher/1.2.2/jars/activator-launcher.jar ...
        [SUCCESSFUL ] com.typesafe.activator#activator-launcher;1.2.2!activator-launcher.jar (25ms)
  ...
  
    :: retrieving :: org.scala-sbt#boot-scala
          confs: [default]
          6 artifacts copied, 0 already retrieved (24060kB/72ms)
   Did not detect an activator project in this directory.
  
   There are three ways to run activator:
  
   1. Recommended: try `activator ui` to create a project in the UI
   2. Use `activator new` to create a project on the command line
   3. Load an existing project by re-running activator in a project directory

ようやく動きそう。

* activator ui を試す [#d8e61b4f]

 LANG:console
 > activator ui
  Checking for a newer version of Activator (current version 1.2.2)...
     ... found updated version of Activator 1.3.2 (replacing 1.2.2)
     ... Please download a new Activator by hand at http://typesafe.com/ (the late
  st version 1.3.2 isn't compatible with this launcher, generation 0 vs. 1).
  Getting com.typesafe.activator activator-ui 1.2.2 ...
  downloading file:////(activator_path)/repository/com.typesafe.activator/activator-ui/1.2.2/jars/activator-ui.jar ...
          [SUCCESSFUL ] com.typesafe.activator#activator-ui;1.2.2!activator-ui.jar (246ms)
  ...
 
  :: retrieving :: org.scala-sbt#boot-app
        confs: [default]
        76 artifacts copied, 0 already retrieved (62932kB/1518ms)
  FOUND REPO = activator-local @ file:////(ativator_path)/repository
  Play server process ID is 294224
  [info] play - Application started (Prod)
  [info] play - Listening for HTTP on /127.0.0.1:8888
  [INFO] [04/21/2015 15:35:47.498] [default-akka.actor.default-dispatcher-7] [akka://default/user/home-socket-1] Firing up web socket

となって、勝手にブラウザで http://127.0.0.1:888/ が開いた。

&attachref(Typesafe Activator-00 startup.png,,50%);

同時に 「Windows セキュリティの重要な警告」が開いた。

&attachref(windows-security-warning.png,,50%);

localhost からの接続のみ受け付ければよいので、念のためチェックを外してキャンセル。

* Hello Scala! を作成 [#k4bc4bcf]

Hello Scala! を選んで Create すると、

http://127.0.0.1:888/app/hello-scala

に遷移した。

&attachref(Typesafe Activator-01 created.png,,50%);

"Run the app>" を選ぶと、左のメニューで "Run" が選択された状態になって、
中央の Logs の部分に "Hello, world!" が表示された。

左のメニューで "Code" を選び、"src/main/scala/Hello.scala" を選ぶと、
中央にファイル内容が表示されて、その場で編集可能になる。

"Hello, world!" を "Hello, world!!!" と地味に編集して、Ctrl+S で保存。

左のメニューで "Run" を押すと、すでに Logs の部分には "Hello, world!!!" が表示されている。

裏でコンパイルしているはずなんだけれど、あまりにシームレスでびっくりする。

あれ?この例は Play Framework に載っていない最低限の物なのか。

* AngularJS Play Mongo というのを試す [#a6ee3cc5]

もっとまともな tutorial を、ということで、これなら

- angularjs
- coffeescript 
- play 
- guice 
- mongodb 
- reactive-mongo 
- bootstrapui 
- rest 
- scala 

のタグが付いていて、一通りのことができそう。

Create 後、Run してから "Open the app: http://localhost:9000" のリンクを踏むと
"Modern Web Template" というタイトルのページが表示されました。
ビルドには結構時間がかかる印象。

で、表示されたフォームを試してみると、そのままではデータの更新ができないみたいです?

"Test" メニューでテストを実行しても controllers.UsersIT でエラーが出ます。~
→ エラーの詳細はどうやったら見られるのだろう???

ソースを見ると UsersIT のテストは json によるデータ更新のテストなので、
やはり何かがうまく行っていない感じ。

テストのログをどこで見られるのか、結局解らない。

あと、テストにえらく時間がかかるのだけれどこんな物なのだろうか???

** ん? [#va21122e]

"Inspect" メニューの所に、

 No requests found. There could be two reasons for this: 
 either there haven't been any requests to your Play application yet or 
 you're running an unsupported Play version (>2.3.0)

というメッセージが出ていた。

Play2.3 はサポート外ということらしい orz

* Play Slick Backbone Todo List Example というのを試す [#x4952298]

あれ、これもだ。

 No requests found. There could be two reasons for this: 
 either there haven't been any requests to your Play application yet or 
 you're running an unsupported Play version (>2.3.0)


Counter: 7974 (from 2010/06/03), today: 2, yesterday: 1