LoginSignup
4
0

More than 5 years have passed since last update.

build.sbtでのunresolved dependencyを解決する

Last updated at Posted at 2016-09-23

現象

ScalaのPlayFrameworkを利用する際,build.sbtファイルが外部ライブラリを読み込まず、Unresolved dependency(ライブラリ依存関係が解決できない旨の)エラーを吐く。

環境

Mac OSX
Intellij IDEA
scala 2.11.8
sbt 0.13
playframework 2.5

解決策

build.sbtでplay-slickを入れたいとする.
以下のようにversionを指定してあげる。
moduleのversionはIntellijの場合、Cmdを二回押したときに画面右端に出てくる
SBT->{project_name}->root->Dependenciesから確認できる.

build.sbt
scalaVersion := "2.11.8"

libraryDependencies ++= Seq(
  jdbc,
  cache,
  ws,
-  "com.typesafe.play" %% "play-slick" % "2.0.0"
+  "com.typesafe.play" % "play-slick_2.11" % "2.0.0"
)

why

%%指定子を用いた場合バージョン指定をsbt任せにできるが、この場合sbtはplay-slick_2.11.8を捜査しているっぽい。
%を用いてバージョン指定することでunresolved dependencyから逃れられた.

4
0
2

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