source jar not recognized as matching class jar
I used sbt eclipse to generate a Scala IDE project from the Heroic GitHub project. Here is my ~/.sbt/plugins/build.sbt:
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse" % "latest.milestone")
Note that I used "latest.milestone", not a specific milestone. Not many people know about this Ivy option, "latest.integration" is more widely documented.
I created an Eclipse project from the Heroic GitHub project using sbteclipse 11.2, using Windows XP SP3.
git clone https://github.com/softprops/heroic
I generated the Eclipse project with:
sbt "eclipse with-source=true"
In heroic.scala, pressing F3 on the import sbt.Project does not display the source, instead the message "Current text selection cannot be opened in an editor" appears. I could see the class file in the Eclipse editor, so I clicked on the "Change attached source" button and manually selected the matching source jar. This message appeared: "The source attachment does not contain the source for the file Project.class". I opened the jars in 7-zip and manually matched up the .scala files against the .class files and found discrepancies. Comparing the contents of main_2.9.1-0.11.2.jar to main_2.9.1-0.11.2-sources.jar, I saw that there was no source for many SBT classes, including TaskKey.scala, Tags.scala, SettingGraph.scala, and others.
I used gen-idea to generate an IntelliJ IDEA project from Heroic, and the SBT jars resolved fine; in IDEA I can click on an sbt.Project reference and go to the source code for sbt.Project. Looks like there may be a Scala IDE bug and an sbt-eclipse bug. I have also filed a bug report with sbt-eclipse. I tried this on a Windows 7 64 bit computer and the results were the same.
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse" % "latest.milestone")
Note that I used "latest.milestone", not a specific milestone. Not many people know about this Ivy option, "latest.integration" is more widely documented.
I created an Eclipse project from the Heroic GitHub project using sbteclipse 11.2, using Windows XP SP3.
git clone https://github.com/softprops/heroic
I generated the Eclipse project with:
sbt "eclipse with-source=true"
In heroic.scala, pressing F3 on the import sbt.Project does not display the source, instead the message "Current text selection cannot be opened in an editor" appears. I could see the class file in the Eclipse editor, so I clicked on the "Change attached source" button and manually selected the matching source jar. This message appeared: "The source attachment does not contain the source for the file Project.class". I opened the jars in 7-zip and manually matched up the .scala files against the .class files and found discrepancies. Comparing the contents of main_2.9.1-0.11.2.jar to main_2.9.1-0.11.2-sources.jar, I saw that there was no source for many SBT classes, including TaskKey.scala, Tags.scala, SettingGraph.scala, and others.
I used gen-idea to generate an IntelliJ IDEA project from Heroic, and the SBT jars resolved fine; in IDEA I can click on an sbt.Project reference and go to the source code for sbt.Project. Looks like there may be a Scala IDE bug and an sbt-eclipse bug. I have also filed a bug report with sbt-eclipse. I tried this on a Windows 7 64 bit computer and the results were the same.
Leave a comment
on 2012-01-10 19:18 *
By Mike Slinn
Description changed from I used sbt eclipse to gener... to I used sbt eclipse to gener...
on 2012-01-11 23:43 *
By Mike Slinn
After trying another Windows 64 bit machine, it looks like the fault lies with Scala IDE. Seems I did not know how .scala files map to compiled .class files, and the bug is that Scala IDE has a similar problem. I have already provided enough information for someone else to duplicate this problem.
on 2012-12-07 13:23 *
By Iulian Dragos
Thanks Mike. This is a known problem: sources have to match the package structure, much like in Java.
Thanks Mike. This is a known problem: sources have to match the package structure, much like in Java.
on 2014-09-01 13:35 *
By Iulian Dragos
Version changed from 2.1.0-nightly-210 to 3.0.4-211
Milestone changed from Lithium to Backlog