Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Library sources not found for scala-library in Intellij

I have an imported sbt project. During import I did NOT click on download sbt sources - and I am unclear as to whether that were the cause of the subsequent issue. In any case is there a way to remedy the missing library as shown in the screenshot?

enter image description here

Clicking on "Download" results in the "Library sources aren't found" as seen above.

Update From an answer below: Going to Other settings|default settings|Build, Execution, Deployment|build tools|SBT Here is what I see:

enter image description here

Another update I went to the Intellij Idea|Preferences|Execution,Deployment,Build and see the following

enter image description here

Note: even after checking Download sbt docs and sources it does not "take": it remains unchecked the next time the dialog is brought up.

like image 746
WestCoastProjects Avatar asked Feb 11 '15 01:02

WestCoastProjects


People also ask

How do I get Scala library in IntelliJ?

To install Scala plugin, press Ctrl+Alt+S , open the Plugins page, browse repositories to locate the Scala plugin, click Install and restart IntelliJ IDEA. Now you can successfully check out from VCS, create, or import Scala projects.

How do I get Scala class in IntelliJ?

In the Project tool window, right-click a Scala library class that you want to decompile. From the context menu, select Decompile Scala to Java. IntelliJ IDEA converts code to Java and opens the converted file in the editor. You can also open the library class in the editor and use its context menu for the conversion.


2 Answers

File -> Settings -> Build, Execution, Deployment -> Build Tools -> SBT, check the "Download sources and Docs". open the SBT panel, and click refresh. Voila.

like image 170
LynxZh Avatar answered Oct 09 '22 12:10

LynxZh


I'm constantly fighting Intellij on Windows (across different versions and updates... mostly EAP, so it's probably my fault), but if I add withSources() withJavadoc() to the end of a library dependency:

libraryDependencies ++= Seq(
  "com.twitter" %% "finatra-http" % versions.finatra withSources() withJavadoc(),

it will download the source and docs. Then when I click Attach Sources... if I point to that in my cache, Intellij will finally update and load the sources correctly.

See http://www.scala-sbt.org/0.13/docs/Library-Management.html#Download+Sources for more details.

like image 27
Eddie Welker Avatar answered Oct 09 '22 14:10

Eddie Welker