LoginSignup
1
1

More than 5 years have passed since last update.

Scala Sprayで開発する時の初期設定

Last updated at Posted at 2015-12-05

自分用

JSONライブラリとassemblyは使うので最初から入れておく

sbt-assembly
https://github.com/sbt/sbt-assembly

play-json
https://www.playframework.com/documentation/ja/2.1.x/ScalaJson

build.sbt

organization  := "org.XXX"

version       := "0.1"

scalaVersion  := "2.11.6"

scalacOptions := Seq("-unchecked", "-deprecation", "-encoding", "utf8", "-Ylog-classpath")

libraryDependencies ++= {
  val akkaV = "2.3.9"
  val sprayV = "1.3.3"
  Seq(
    "io.spray"            %%  "spray-can"     % sprayV,
    "io.spray"            %%  "spray-routing" % sprayV,
    "io.spray"            %%  "spray-testkit" % sprayV  % "test",
    "com.typesafe.akka"   %%  "akka-actor"    % akkaV,
    "com.typesafe.akka"   %%  "akka-testkit"  % akkaV   % "test",
    "org.specs2"          %%  "specs2-core"   % "2.3.11" % "test",
    "org.scalikejdbc"     %%  "scalikejdbc"    % "2.2.+",
    "org.slf4j"           %   "slf4j-simple"   % "1.7.+",
    "mysql"               %   "mysql-connector-java" % "5.1.29",
    "com.typesafe.play"   %   "play-json_2.11" % "2.4.2"
  )
}

ivyScala := ivyScala.value map { _.copy(overrideScalaVersion = true) }

Revolver.settings


assemblyMergeStrategy in assembly := {
  case PathList("javax", "servlet", xs @ _*)         => MergeStrategy.first
  case PathList(ps @ _*) if ps.last endsWith ".properties" => MergeStrategy.first
  case PathList(ps @ _*) if ps.last endsWith ".xml" => MergeStrategy.first
  case PathList(ps @ _*) if ps.last endsWith ".types" => MergeStrategy.first
  case PathList(ps @ _*) if ps.last endsWith ".class" => MergeStrategy.first
  case "application.conf"                            => MergeStrategy.concat
  case "unwanted.txt"                                => MergeStrategy.discard
  case x =>
    val oldStrategy = (assemblyMergeStrategy in assembly).value
    oldStrategy(x)
}

application.conf

akka {
  loglevel = INFO
}

spray.can.server {
  request-timeout = 1s
}

include "securesocial.conf"

plugins.sbt

addSbtPlugin("io.spray" % "sbt-revolver" % "0.7.2")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.1")

1
1
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
1
1