LoginSignup
2
4

More than 5 years have passed since last update.

PlayFrameWork2.5+Scala+EclipseをWindows10で開発環境を準備してみた

Last updated at Posted at 2016-06-29

開発環境

  • Windows10
  • Eclipse Mars.2 Release (4.5.2)
  • JDK1.8
  • PlayFrameWork2.5.4

環境準備

EclipseにScalaプラグインをインストール

ヘルプ⇒新規ソフトウェアの追加
から以下のURLから全て選択してインストールする
http://download.scala-ide.org/sdk/lithium/e44/scala211/stable/site

PlayFrameWorkのインストール

ダウンロードしたzipファイルを任意の場所に解凍する。
https://www.playframework.com/download
image

activatorのPATH設定

インストールしたパスにあるbinを指定する

C:\framework\activator-1.3.10-minimal\bin

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

コマンドプロンプトから実行する

playScalaTestプロジェクトをscala「6) play-scala」で作成する。

c:\work>activator new playScalaTest
ACTIVATOR_HOME=C:\framework\activator-1.3.10-minimal
ファイル BIN_DIRECTORY\..\conf\sbtconfig.txt が見つかりません。

Fetching the latest list of templates...

Browse the list of templates: http://lightbend.com/activator/templates
Choose from these featured templates or enter a template name:
  1) minimal-akka-java-seed
  2) minimal-akka-scala-seed
  3) minimal-java
  4) minimal-scala
  5) play-java
  6) play-scala
(hit tab to see a list of all templates)
> 6
OK, application "playScalaTest" is being created using the "play-scala" template.

To run "playScalaTest" from the command line, "cd playScalaTest" then:
C:\framework\play\playScalaTest/activator run

To run the test for "playScalaTest" from the command line, "cd playScalaTest" then:
C:\framework\play\playScalaTest/activator test

To run the Activator UI for "playScalaTest" from the command line, "cd playScalaTest" then:
C:\framework\play\playScalaTest/activator ui

Eclipse用の設定ファイルの生成

設定ファイルの変更

playScalaTest\project\plugins.sbt
// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.5.4")

// web plugins

addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.1.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.3")

addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.7")

addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-mocha" % "1.1.0")

addSbtPlugin("org.irundaia.sbt" % "sbt-sassify" % "1.4.2")

// 以下を追記
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "4.0.0")

eclipseコマンドでeclipse用の設定ファイルを作成

c:\work\playScalaTest>activator eclipse
ACTIVATOR_HOME=C:\framework\activator-1.3.10-minimal
ファイル BIN_DIRECTORY\..\conf\sbtconfig.txt が見つかりません。
[info] Loading project definition from C:\framework\play\playScalaTest\project
[info] Updating {file:/C:/framework/play/playScalaTest/project/}playscalatest-build...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Set current project to playScalaTest (in build file:/C:/framework/play/playScalaTest/)
[info] About to create Eclipse project files for your project(s).
[info] Updating {file:/C:/framework/play/playScalaTest/}root...
[info] Resolving jline#jline;2.12.1 ...
[info] Done updating.
[info] Successfully created Eclipse project files for project(s):
[info] playScalaTest

プロジェクト直下に.settingsフォルダが作成される

Eclipseに作成したプロジェクトを取り込む

ファイル⇒インポート⇒
既存のプロジェクトをワークスペースへ⇒
ルートディレクトリ選択にプロジェクトを作成したパスを入力⇒
作成したプロジェクトにチェックを入れる⇒完了

Eclipseで実行する準備

実行⇒外部ツール⇒外部ツールの構成⇒
プログラムを右クリックし新規⇒
ロケーションにPlayFrameWorkをインストールしたパスにあるactivator.batを設定

ロケーション
C:\framework\activator-1.3.10-minimal\bin\activator.bat
作業ディレクトリ
${project_loc}
引数
run

Eclipseで実行

プロジェクトを選択⇒実行⇒外部ツール⇒上で作成した外部ツールを選択
※右クリックの実行、デバッグから外部ツールは選択できない

ブラウザに以下のURLを入力
http://localhost:9000/
image

2
4
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
2
4