読者です 読者をやめる 読者になる 読者になる

Play frameworkでエラー

Playframework Scala

scalaが動作する環境でPlay!2.0.2をインストール後、play help などのコマンド実行時にエラーが発生することに気づきました。

[sourcecode language="bash"] $ play help Getting org.scala-sbt sbt_2.9.1 0.11.2 ...

:: problems summary :: :::: WARNINGS module not found: org.scala-sbt#sbt_2.9.1;0.11.2

 ==== local: tried

   /usr/local/bin/../Cellar/play/2.0.2/bin/../libexec/framework/../repository/local/org.scala-sbt/sbt_2.9.1/0.11.2/ivys/ivy.xml

 ==== Maven2 Local: tried

   file:///Users/ymanabe/.m2/repository/org/scala-sbt/sbt_2.9.1/0.11.2/sbt_2.9.1-0.11.2.pom

 ==== typesafe-ivy-releases: tried

   http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt_2.9.1/0.11.2/ivys/ivy.xml

 ==== Maven Central: tried

   http://repo1.maven.org/maven2/org/scala-sbt/sbt_2.9.1/0.11.2/sbt_2.9.1-0.11.2.pom

      ::::::::::::::::::::::::::::::::::::::::::::::

      ::          UNRESOLVED DEPENDENCIES         ::

      ::::::::::::::::::::::::::::::::::::::::::::::

      :: org.scala-sbt#sbt_2.9.1;0.11.2: not found

      ::::::::::::::::::::::::::::::::::::::::::::::

:: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS unresolved dependency: org.scala-sbt#sbt_2.9.1;0.11.2: not found Error during sbt execution: Error retrieving required libraries (see /usr/local/bin/../Cellar/play/2.0.2/bin/../libexec/framework/sbt/boot/update.log for complete log) Error: Could not retrieve sbt 0.11.2 [/sourcecode]

エラーメッセージから sbt というものがインストールされていないことが原因らしいことはわかるわけですが、そもそもsbtがよくわからない…

そこで調べてみたところ、scalaで利用するビルドツールらしいということがわかりました。

■Scalaの環境構築について詳しく説明されています。参考にさせていただきました! Scalaの開発環境入門

早速インストールしました。

[sourcecode language="bash"] $ brew install sbt ==> Downloading http://typesafe.artifactoryonline.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/0.11.3-2/sbt-launch.jar

################################################################## 100.0%

==> Caveats You can use $SBT_OPTS to pass additional JVM options to SBT. For convenience, this can specified in ~/.sbtconfig.

For example: SBT_OPTS="-XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M" ==> Summary /usr/local/Cellar/sbt/0.11.3-2: 3 files, 1.1M, built in 6 seconds

[/sourcecode]

インストール後にplay helpコマンドを実行すると、やはりエラーになりました。とりあえず、sbtをインストールしたので実行してみるとなにやらアップデートを行いはじめたようです…

[sourcecode language="bash"] $ sbt Getting org.scala-sbt sbt_2.9.1 0.11.3 ... downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt_2.9.1/0.11.3/jars/sbt_2.9.1.jar ... [SUCCESSFUL ] org.scala-sbt#sbt_2.9.1;0.11.3!sbt_2.9.1.jar (1582ms) downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/main_2.9.1/0.11.3/jars/main_2.9.1.jar ... [SUCCESSFUL ] org.scala-sbt#main_2.9.1;0.11.3!main_2.9.1.jar (6876ms) downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/compiler-interface/0.11.3/jars/compiler-interface-bin.jar ... [SUCCESSFUL ] org.scala-sbt#compiler-interface;0.11.3!compiler-interface-bin.jar (1936ms) downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/compiler-interface/0.11.3/jars/compiler-interface-src.jar ... [SUCCESSFUL ] org.scala-sbt#compiler-interface;0.11.3!compiler-interface-src.jar (1843ms) downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/precompiled-2_8_2/0.11.3/jars/compiler-interface-bin.jar ... [SUCCESSFUL ] org.scala-sbt#precompiled-2_8_2;0.11.3!compiler-interface-bin.jar (2859ms) downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/precompiled-2_8_1/0.11.3/jars/compiler-interface-bin.jar ... [SUCCESSFUL ] org.scala-sbt#precompiled-2_8_1;0.11.3!compiler-interface-bin.jar (2157ms) downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/precompiled-2_9_2/0.11.3/jars/compiler-interface-bin.jar ... [SUCCESSFUL ] org.scala-sbt#precompiled-2_9_2;0.11.3!compiler-interface-bin.jar (1841ms) downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/actions_2.9.1/0.11.3/jars/actions_2.9.1.jar ... [SUCCESSFUL ] org.scala-sbt#actions_2.9.1;0.11.3!actions_2.9.1.jar (2155ms) downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/interface/0.11.3/jars/interface.jar ... [SUCCESSFUL ] org.scala-sbt#interface;0.11.3!interface.jar (1314ms) downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/io_2.9.1/0.11.3/jars/io_2.9.1.jar ... [SUCCESSFUL ] org.scala-sbt#io_2.9.1;0.11.3!io_2.9.1.jar (3075ms) downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/ivy_2.9.1/0.11.3/jars/ivy_2.9.1.jar ... [SUCCESSFUL ] org.scala-sbt#ivy_2.9.1;0.11.3!ivy_2.9.1.jar (3478ms) downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/launcher-interface_2.9.1/0.11.3/jars/launcher-interface_2.9.1.jar ... [SUCCESSFUL ] org.scala-sbt#launcher-interface_2.9.1;0.11.3!launcher-interface_2.9.1.jar (1943ms) downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/logging_2.9.1/0.11.3/jars/logging_2.9.1.jar ... [SUCCESSFUL ] org.scala-sbt#logging_2.9.1;0.11.3!logging_2.9.1.jar (2661ms) downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/process_2.9.1/0.11.3/jars/process_2.9.1.jar ... [SUCCESSFUL ] org.scala-sbt#process_2.9.1;0.11.3!process_2.9.1.jar (1940ms) downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/run_2.9.1/0.11.3/jars/run_2.9.1.jar ... [SUCCESSFUL ] org.scala-sbt#run_2.9.1;0.11.3!run_2.9.1.jar (1741ms) downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/classfile_2.9.1/0.11.3/jars/classfile_2.9.1.jar ... [SUCCESSFUL ] org.scala-sbt#classfile_2.9.1;0.11.3!classfile_2.9.1.jar (1525ms) downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/classpath_2.9.1/0.11.3/jars/classpath_2.9.1.jar ... [SUCCESSFUL ] org.scala-sbt#classpath_2.9.1;0.11.3!classpath_2.9.1.jar (1445ms) downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/incremental-compiler_2.9.1/0.11.3/jars/incremental-compiler_2.9.1.jar ... [SUCCESSFUL ] org.scala-sbt#incremental-compiler_2.9.1;0.11.3!incremental-compiler_2.9.1.jar (2144ms) downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/persist_2.9.1/0.11.3/jars/persist_2.9.1.jar ... [SUCCESSFUL ] org.scala-sbt#persist_2.9.1;0.11.3!persist_2.9.1.jar (2660ms) downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/compile_2.9.1/0.11.3/jars/compile_2.9.1.jar ... [SUCCESSFUL ] org.scala-sbt#compile_2.9.1;0.11.3!compile_2.9.1.jar (3163ms) downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/completion_2.9.1/0.11.3/jars/completion_2.9.1.jar ... [SUCCESSFUL ] org.scala-sbt#completion_2.9.1;0.11.3!completion_2.9.1.jar (2670ms) downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/api_2.9.1/0.11.3/jars/api_2.9.1.jar ... [SUCCESSFUL ] org.scala-sbt#api_2.9.1;0.11.3!api_2.9.1.jar (2116ms) downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/task-system_2.9.1/0.11.3/jars/task-system_2.9.1.jar ... [SUCCESSFUL ] org.scala-sbt#task-system_2.9.1;0.11.3!task-system_2.9.1.jar (1460ms) downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/tasks_2.9.1/0.11.3/jars/tasks_2.9.1.jar ... [SUCCESSFUL ] org.scala-sbt#tasks_2.9.1;0.11.3!tasks_2.9.1.jar (1443ms) downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/tracking_2.9.1/0.11.3/jars/tracking_2.9.1.jar ... [SUCCESSFUL ] org.scala-sbt#tracking_2.9.1;0.11.3!tracking_2.9.1.jar (1423ms) downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/testing_2.9.1/0.11.3/jars/testing_2.9.1.jar ... [SUCCESSFUL ] org.scala-sbt#testing_2.9.1;0.11.3!testing_2.9.1.jar (1739ms) downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/control_2.9.1/0.11.3/jars/control_2.9.1.jar ... [SUCCESSFUL ] org.scala-sbt#control_2.9.1;0.11.3!control_2.9.1.jar (1318ms) downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/collections_2.9.1/0.11.3/jars/collections_2.9.1.jar ... [SUCCESSFUL ] org.scala-sbt#collections_2.9.1;0.11.3!collections_2.9.1.jar (2353ms) downloading http://repo1.maven.org/maven2/com/jcraft/jsch/0.1.46/jsch-0.1.46.jar ... [SUCCESSFUL ] com.jcraft#jsch;0.1.46!jsch.jar (645ms) downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/cache_2.9.1/0.11.3/jars/cache_2.9.1.jar ... [SUCCESSFUL ] org.scala-sbt#cache_2.9.1;0.11.3!cache_2.9.1.jar (3123ms)

:: problems summary :: :::: ERRORS SERVER ERROR: Internal Server Error url=https://oss.sonatype.org/content/repositories/snapshots/org/sonatype/oss/oss-parent/6/oss-parent-6.jar

:: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS :: retrieving :: org.scala-sbt#boot-app confs: [default] 37 artifacts copied, 0 already retrieved (7245kB/111ms) [info] Loading project definition from /Users/ymanabe/.sbt [info] Updating {file:/Users/ymanabe/.sbt/}default-ecd539... [info] Resolving org.scala-sbt#sbt_2.9.1;0.11.3 ... [info] Resolving org.scala-sbt#main_2.9.1;0.11.3 ... [info] Resolving org.scala-sbt#actions_2.9.1;0.11.3 ... [info] Resolving org.scala-sbt#classfile_2.9.1;0.11.3 ... [info] Resolving org.scala-sbt#io_2.9.1;0.11.3 ... [info] Resolving org.scala-sbt#control_2.9.1;0.11.3 ... [info] Resolving org.scala-lang#scala-library;2.9.1 ... [info] Resolving org.scala-sbt#interface;0.11.3 ... [info] Resolving org.scala-sbt#logging_2.9.1;0.11.3 ... [info] Resolving org.scala-sbt#process_2.9.1;0.11.3 ... [info] Resolving org.scala-sbt#classpath_2.9.1;0.11.3 ... [info] Resolving org.scala-sbt#launcher-interface_2.9.1;0.11.3 ... [info] Resolving org.scala-lang#scala-compiler;2.9.1 ... [info] Resolving org.scala-sbt#incremental-compiler_2.9.1;0.11.3 ... [info] Resolving org.scala-sbt#collections_2.9.1;0.11.3 ... [info] Resolving org.scala-sbt#api_2.9.1;0.11.3 ... [info] Resolving org.scala-sbt#persist_2.9.1;0.11.3 ... [info] Resolving org.scala-tools.sbinary#sbinary_2.9.0;0.4.0 ... [info] Resolving org.scala-sbt#compile_2.9.1;0.11.3 ... [info] Resolving org.scala-sbt#ivy_2.9.1;0.11.3 ... [info] Resolving org.apache.ivy#ivy;2.2.0 ... [info] Resolving com.jcraft#jsch;0.1.46 ... [info] Resolving commons-httpclient#commons-httpclient;3.1 ... [info] Resolving commons-logging#commons-logging;1.0.4 ... [info] Resolving commons-codec#commons-codec;1.2 ... [info] Resolving org.scala-sbt#completion_2.9.1;0.11.3 ... [info] Resolving jline#jline;0.9.94 ... [info] Resolving org.scala-sbt#run_2.9.1;0.11.3 ... [info] Resolving org.scala-sbt#task-system_2.9.1;0.11.3 ... [info] Resolving org.scala-sbt#tasks_2.9.1;0.11.3 ... [info] Resolving org.scala-sbt#tracking_2.9.1;0.11.3 ... [info] Resolving org.scala-sbt#cache_2.9.1;0.11.3 ... [info] Resolving org.scala-sbt#testing_2.9.1;0.11.3 ... [info] Resolving org.scala-tools.testing#test-interface;0.5 ... [info] Resolving org.scala-sbt#compiler-interface;0.11.3 ... [info] Resolving org.scala-sbt#precompiled-2_8_2;0.11.3 ... [info] Resolving org.scala-sbt#precompiled-2_8_1;0.11.3 ... [info] Resolving org.scala-sbt#precompiled-2_9_2;0.11.3 ... [info] Done updating. [info] Set current project to default-b9f43b (in build file:/Users/ymanabe/) > exit

[/sourcecode]

一通り終了するとプロンプトに変わったため、exit をクリックして終了しました。

※後から知ったのですが、sbtを引数なしで実行した(インタラクティブモードで実行した)ようです。 始める sbt - ようこそ

このあと play help コマンドを実行すると見慣れた画面が表示されました。

[sourcecode language="bash"] $ play help _ _ _ | | _ _ | | | ' | |/ ' | || || | /||_|_ () |_| |__/

play! 2.0.2, http://www.playframework.org

Welcome to Play 2.0!

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.org.

[/sourcecode]

ちなみに、PlayをIntelliJ IDEAで利用する場合、1.2系と2.0系でコマンドが異なりますね。

1.2系:play idealize 2.0系:play idea

※Playの公式サイトには

[sourcecode language="bash"] $idea [/sourcecode]

と書かれていますが、こちらでは何も起きず、

[sourcecode language="bash"] $play idea [/sourcecode]

とすると正常にファイルが作成されました。