Attach sources does not seem to work

Answered

What is the deal with attach sources?   Is there some magic sequence of steps to get it to "take" ?

An example here: i added jackson-json.<version>.jar to the project (systemPath in maven), that works fine.  Then when clicking on code that uses it, "Source not found". Which is also fine. Then I click on "Attach sources" and select jackson-jsonpath-2.1.0-SNAPSHOT-sources.jar.   Well, no error message. And also no effect: the sources are still never found.

That was an example. I have seen this pattern repeatedly. I'd be happy to learn there were some additional step required (but not obvious or documented) to fix this issue.

thanks

3
6 comments

I see a stackoverflow question on this - apparently this really does not work..  Is there a fix in progress (or delivered but i fail to see it..) for this?


http://stackoverflow.com/questions/13520532/attaching-sources-in-intellij-idea-for-scala-project


From that SOF post: Aha.. fixed.
   So: I used to use 'attach source' in the top of the window editor - it does not work (I guess it is a bug - maybe related to the scala plugin, because usually it works).
  But if try to attache sources to particular library - in "Project Structure -> Library -> +Attach File or Directories -> Sources" then it works.
  Thanks.

0

(deleted comment)

.

0

Yes, downloading and attaching sources via the IDE is buggy. What I found useful was to enable maven to do this default (downloading sources / javadoc) when downloading the dependency by modifying my maven settings.xml.

But if you don't want that but do it for a particular project, then do the below:

mvn dependency:sources
mvn dependency:resolve -Dclassifier=javadoc
 
0
Avatar
Permanently deleted user

This functions is still broken:

I click:

Select file:

 

 

and nothing happens, renavigating to method text doesn't help

0

Hello.

Please raise a ticket at https://youtrack.jetbrains.com/issues

0

https://youtrack.jetbrains.com/issue/SCL-14678 shows a way to auto attach sources.

I've tried it out, and I am so glad, it works!

It refers to https://scalacenter.github.io/bloop/docs/build-tools/sbt#download-dependencies-sources 

in Summary: add to your build.sbt this single line: 

bloopExportJarClassifiers in Global := Some(Set("sources"))

and then in IntelliJ: "Invalidate Caches / Restart" so the sources get indexed.
"sbt updateClassifiers" is eventually needed before.

0

Please sign in to leave a comment.