LoginSignup
21
14

More than 5 years have passed since last update.

sbtの"unresolved dependency"のデバッグ

Last updated at Posted at 2014-11-23

A. pomファイルがあるかチェック

sbtのログにアクセスしたURLが下のように出ているので、見つからないライブラリがあるはずのURLにブラウザでアクセスしてみる。

[info] Resolving com.github.ikuo#garapon4s_2.10;0.3.0 ...
[warn]  module not found: com.github.ikuo#garapon4s_2.10;0.3.0
...
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/com/github/ikuo/garapon4s_2.10/0.3.0/garapon4s_2.10-0.3.0.pom
[warn] ==== Sonatype Releases: tried
[warn]   http://oss.sonatype.org/content/repositories/releases/com/github/ikuo/garapon4s_2.10/0.3.0/garapon4s_2.10-0.3.0.pom
...

ブラウザでアクセスしてもファイルがない場合、特定のScalaバージョンのみしかファイルが公開されていないことがあるので、URLの階層を上に辿ってみる。その結果例えば「..._2.10はないけど ..._2.11 はある」ということが分かったら、build.sbtの依存性定義 libraryDependencies ++= Seq(...) のところでscalaバージョンを 2.11 に明示的に指定する。

B. キャッシュのクリア

  1. ~/.ivy2/local/, ~/.ivy2/cache/ のディレクトリにそれぞれ見つからないライブラリの名前のフォルダがあれば、それを消す
  2. プロジェクトの ./target ディレクトリ、./project/target ディレクトリを消す
  3. sbt で clean update タスクを順に実行する
21
14
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
21
14