タイトル通り。気づかなかったのでハマった。
sbtは、標準じゃないリポジトリを使う場合、別途書かなければならない
sbtの公式ドキュメントが
http://www.scala-sbt.org/0.13/docs/ja/Library-Dependencies.html
依存ライブラリがデフォルトのリポジトリに存在しないなら、Ivy がそれを見つけられるよう resolver を追加する必要がある。
と謳っているため、導入したいレポジトリのpom.xmlに<repositories>...</repositories>
が存在するとき、
そこに書き込まれている依存レポジトリ情報を、手動で build.sbt
やBuild.scala
に追加してやる必要がある。
実際に遭遇した例
Mavenレポジトリに存在するCSV Validator1を使おうと思い
build.sbt(インポートできない)
libraryDependencies += "uk.gov.nationalarchives" % "csv-validator-core" % "1.1.2"
と書いて $ sbt compile
を行ったところ、UNRESOLVED DEPENDENCIESが起きた。
pomファイル2を調べた所、pomファイルに書かれている、読まれるべきレポジトリをsbtが読み込んでいないことに気づいた。以下のようにbuild.sbt
に追記したところCSV Validatorをインポートすることが出来た。
build.sbt(依存レポジトリ情報を追加したため、インポートできる)
resolvers += "Scalaz Bintray Repo" at "http://dl.bintray.com/scalaz/releases"
resolvers += "Gilt Group Bintray Repo" at "http://dl.bintray.com/giltgroupe/maven"
libraryDependencies += "uk.gov.nationalarchives" % "csv-validator-java-api" % "1.1.2"
csv-validator-core-1.1.2.pom(依存レポジトリ情報が書かれている)
:
<repositories>
<repository>
<id>scalaz-bintray</id>
<name>Scalaz Bintray Repo</name>
<url>http://dl.bintray.com/scalaz/releases</url>
<!-- needed for scalaz-stream -->
</repository>
<repository>
<id>gilt-group</id>
<name>Gilt Group Bintray Repo</name>
<url>http://dl.bintray.com/giltgroupe/maven</url>
<!-- needed for gfc-semver -->
</repository>
</repositories>
: