简体   繁体   中英

Add lib dir to IntelliJ for unmanaged sbt dependencies

sbt allows manually copying in jars to lib/ - it will find and use these unmanaged dependencies. IntelliJ, though, can't seem to find anything I put it that dir. How can I tell it to use them?

You have to add these manually:

  1. Menu File - Project structure
  2. Left side: Select "Modules"
  3. Right side: Select "Dependencies tab"
  4. Click "+"
  5. Choose "Jars or directories"

Create a lib directory directly under your project directory and place your jar (or symbolic link to jar) there. Note, if you're executing sbt from command prompt, you'll need to be in the project directory for this to work.

Duplicate of How to add Jar libraries to an IntelliJ Idea SBT Scala project? .

The better way to do it is to add your unmanaged dependencies to your build.sbt and refrain from leaving part of your dependency management to your IDE.

Refer to http://www.scala-sbt.org/release/docs/Library-Management.html for details on how to define your unmanagedBase and unmanagedJars tasks.

将jar添加到lib目录后,在build.sbt添加此行

exportJars := true

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM