Skip to content

Commit

Permalink
assembling fat jar
Browse files Browse the repository at this point in the history
  • Loading branch information
SunPj committed Jun 28, 2016
1 parent ed22bda commit 705b5d2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
19 changes: 19 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,22 @@ libraryDependencies ++= Seq(

// new repo on maven.org
libraryDependencies += "com.github.etaty" %% "rediscala" % "1.6.0"

lazy val commonSettings = Seq(
version := "0.1-SNAPSHOT",
organization := "com.example",
scalaVersion := "2.10.1",
test in assembly := {}
)

lazy val app = (project in file("app")).
settings(commonSettings: _*).
settings(
mainClass in assembly := Some("com.example.Server")
)

lazy val utils = (project in file("utils")).
settings(commonSettings: _*).
settings(
assemblyJarName in assembly := "akka-http-redis.jar"
)
1 change: 1 addition & 0 deletions project/assembly.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.3")
2 changes: 1 addition & 1 deletion src/main/scala/com/example/Server.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ object Server {
val maybeItem: Future[Option[ByteString]] = redis.get(key.toString)

onSuccess(maybeItem) {
case Some(item) => complete(HttpEntity(ContentTypes.`application/json`, s"""{"key": $key, "value": "$item"}"""))
case Some(item) => complete(HttpEntity(ContentTypes.`application/json`, s"""{"key": $key, "value": "${item.utf8String}"}"""))
case None => complete(StatusCodes.NoContent)
}
}
Expand Down

0 comments on commit 705b5d2

Please sign in to comment.