LoginSignup
10
8

More than 5 years have passed since last update.

build.sbtの依存ライブラリ定義例一覧

Last updated at Posted at 2016-01-20

build.sbtで定義する依存ライブラリの具体例を列挙してみた。
URLはバージョン一覧もしくは最新のバージョンを確認できる場所で、一部プラグインの設定も含む。
libraryDependenciesの基本形は以下の通りでconfigurationは省略可。


libraryDependencies += groupID % artifactID % revision % configuration


groupIDの後ろを「%%」とすると定義されたscalaのバージョンをartifactIDに追記してくれる。
%% を使って正しい Scala バージョンを入手する

playframework

https://www.playframework.com/download
playframework用の共通ライブラリを作りたい場合はこれを入れる


libraryDependencies += "com.typesafe.play" %% "play" % "2.3.10"

play.cache (playframework)

https://www.playframework.com/download
バージョンはplayと同じと思われる。


libraryDependencies += "com.typesafe.play" %% "play-cache" % "2.3.10"

play-slick

https://github.com/playframework/play-slick


libraryDependencies += "com.typesafe.play" %% "play-slick" % "0.8.0"

specs2

テスティングフレームワーク。
http://mvnrepository.com/artifact/org.specs2


libraryDependencies += "org.specs2" %% "specs2" % "2.3.13" % "test"
//Spect2+JUnitのテスト定義例
testOptions += Tests.Argument(TestFrameworks.Specs2, "console", "junitxml")

scalatestplay

テスティングフレームワーク。
1.5を境に記述方法が異なるので注意
1.5以降
http://mvnrepository.com/artifact/org.scalatestplus.play/scalatestplus-play_2.11


libraryDependencies += "org.scalatestplus.play" %% "scalatestplus-play" % "1.5.1" % "test"

1.5以下



libraryDependencies += "org.scalatestplus" %% "play" % "1.4.0" % "test"

mockito

mock作成ライブラリ。
http://mvnrepository.com/artifact/org.mockito/mockito-all


libraryDependencies += "org.mockito" % "mockito-all" % "1.10.19" % "test"

JUnit

テスティングフレームワーク。
http://junit.org/


libraryDependencies += "junit" % "junit" % "4.12" % "test"
//Spect2+JUnitのテスト定義例
testOptions += Tests.Argument(TestFrameworks.Specs2, "console", "junitxml")

SCCT (Scala Code Coverage Tool)

コードカバレッジ計測ツール。
https://github.com/sqality/scct


//project/plugins.sbt
addSbtPlugin("com.sqality.scct" % "sbt-scct" % "0.3")

//build.sbt
ScctPlugin.instrumentSettings

sbt-assembly

依存関係含めてパッケージ化するプラグイン。
jarファイルのみで実行可能となる。
https://github.com/sbt/sbt-assembly


//project/plugins.sbt
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.11.2")

//build.sbt
assemblySettings

sbteclipse-plugin

Eclipse用プラグイン。
activator eclipseが実行可能になる。
https://github.com/typesafehub/sbteclipse


//project/plugins.sbt
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "4.0.0")

scalaj-http

http://mvnrepository.com/artifact/org.scalaj/scalaj-http_2.11


libraryDependencies += "org.scalaj" %% "scalaj-http" % "0.3.16"

scalaStyle

scalaのコーディングスタイルチェッカー。
http://www.scalastyle.org/sbt.html


//project/plugins.sbt
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "0.8.0")

下記XMLをscalastyle-config.xmlにリネームしてプロジェクトルート直下に置く。

apache HttpClient

HTTPS通信するためのライブラリ。
http://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient


libraryDependencies += "org.apache.httpcomponents" % "httpclient" % "4.5.1"

aws-java-sdk

http://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk


libraryDependencies += "com.amazonaws" % "aws-java-sdk" % "1.10.54"
//上記の記述だと必要ないものが大量に追加されるので、基本的には使いたいものだけ追加すればOK
libraryDependencies += "com.amazonaws" % "aws-java-sdk-s3" % "1.10.54"

aws-lambda-java-core

http://mvnrepository.com/artifact/com.amazonaws/aws-lambda-java-core
lambda用のソースコードを実装する際に使用する。


libraryDependencies += "com.amazonaws" % "aws-lambda-java-core" % "1.1.0"

mysql-connector-java

http://mvnrepository.com/artifact/mysql/mysql-connector-java


libraryDependencies += "mysql" % "mysql-connector-java" % "5.1.39"
10
8
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
10
8