Scala/sbt/ライブラリを追加する

Scala/sbt/ライブラリを追加する

Scala/sbt/Scalaプロジェクトをビルドしてみる でのビルドにライブラリを追加してみる

sjson

JSON 関係のライブラリに sjson というものがあるので今回はこいつを追加してみる

Maven のリポジトリに置いてあるのでこいつを取ってくるようにする Maven Repository: net.debasishg » sjson_2.11 » 0.20

丁寧にこのページに sbt への追加のコードも載っている

libraryDependencies += "net.debasishg" % "sjson_2.11" % "0.20"

build.sbt にはこのように記述

val json = "net.debasishg" % "sjson_2.11" % "0.20"
 
lazy val root = (project in file(".")).
  settings(
    name := "hogehoge",
    version := "1.0",
    scalaVersion := "2.11.7",
    libraryDependencies += json
  )

コンパイルしてみる

$ sbt compile
...
[info] downloading https://repo1.maven.org/maven2/net/debasishg/sjson_2.11/0.20/sjson_2.11-0.20.jar ...
[info] 	[SUCCESSFUL ] net.debasishg#sjson_2.11;0.20!sjson_2.11.jar (2118ms)
[info] downloading https://repo1.maven.org/maven2/net/databinder/dispatch-json_2.11/0.8.10/dispatch-json_2.11-0.8.10.jar ...
[info] 	[SUCCESSFUL ] net.databinder#dispatch-json_2.11;0.8.10!dispatch-json_2.11.jar (1008ms)
[info] downloading https://repo1.maven.org/maven2/commons-io/commons-io/1.4/commons-io-1.4.jar ...
[info] 	[SUCCESSFUL ] commons-io#commons-io;1.4!commons-io.jar (979ms)
[info] Done updating.

なにやらダウンロードが完了したようでOK

scala/sbt/add_library.txt · 最終更新: 2015-08-27 18:21 by ore