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?
Asked
Active
Viewed 6,887 times
18

SRobertJames
- 8,210
- 14
- 60
- 107
-
If you have the jars in the `lib` folder you need to add it to the class path in file -> project structure -> libraries – Ende Neu Jul 06 '14 at 20:20
-
@EndeNeu is this true for sbt projects not in IntelliJ? The sbt documentation is really unclear about where the lib folder for jars should be in the sbt directory structure – redeagle47 Feb 20 '15 at 21:14
-
1@redeagle47 I don't think so but I'm also no 100% sure as I've never done such a thing. – Ende Neu Feb 20 '15 at 21:18
4 Answers
18
You have to add these manually:
- Menu File - Project structure
- Left side: Select "Modules"
- Right side: Select "Dependencies tab"
- Click "+"
- Choose "Jars or directories"

Beryllium
- 12,808
- 10
- 56
- 86
-
1i was hoping that IntelliJ sbt plugin would automagically detect it...oh well, maybe in a future version of the plugin. – Dexter Legaspi Aug 03 '16 at 00:36
-
Sadly this doesn't seem to work in a multi-module sbt project (Intellij 2017.3.4, sbt 1.1.1, Scala 2.12.4). By trial and error, I came up with a possible workaround, described in https://stackoverflow.com/a/48814413/8439351 – schrödingcöder Feb 15 '18 at 19:17
2
After adding the jars to the lib directory , add this line in build.sbt
exportJars := true

Apoorv Shrivastava
- 63
- 4
1
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.

Bojana Parman
- 11
- 1
1
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.