LoginSignup
5

More than 5 years have passed since last update.

sbt環境で外部jarのimportでエラーが出るとき

Posted at

詳しくはsbtドキュメントのライブラリ依存性アンマネージ依存性を参照

IntelliJでFile->Project Structure->Modules->Dependenciesにjarを追加するだけではsbt runでbuildするときにjarのimport hoge.hogeしたライブラリが見つからないと言われる。

ライブラリのパスを教えてあげるためにプロジェクトのbuild.sbtunmanagedBase := baseDirectory.value / "libs"の一行を加える。baseDirectory.valueはプロジェクトのルートディレクトリ、"libs"はjarを配置するディレクトリ(デフォルトでは存在しない)。あとは、libsの中にjarを入れてあげればOK。

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
5