0

I have the following imports in a Play! controller:

import reactivemongo.play.json.collection.JSONCollection
import reactivemongo.play.json.commands.JSONAggregationFramework.{Match,       Unwind, Project, AggregationResult}

The first import(JSONCollection case class) is in the ........ivy2\cache\org.reactivemongo\reactivemongo-play-json_2.11\jars\reactivemongo-play-json_2.11-0.11.14.jar

The second one (object JSONAggregationFramework) is in the same library but extends AggregationFramework which is in the: .........ivy2\cache\org.reactivemongo\reactivemongo_2.11\jars\reactivemongo_2.11-0.11.14.jar

Both libraries have the sources and JavaDocs attached. But, when I CTRL-Click in Eclipse(Scala IDE) on their name I get a fastidious

**Source Not Found 
The source attachment does not contain the source for the...
You can change the source attachment by clicking ...**

error.

I checked and the source JARS contain the aforementioned classes.

Is this a bug, or am I doing something wrong?

P.S.

I can just go in the left pane and click to open any class in the reactivemongo_2.11-0.11.14.jar library and I'll arrive to the same issue!

This does not happen for the classes in: .......ivy2\cache\org.reactivemongo\play2-reactivemongo_2.11\jars\play2-reactivemongo_2.11-0.11.14.jar though, where I am able to see the sources.

Many thanks in advance!

cchantep
  • 9,118
  • 3
  • 30
  • 41
Adrian
  • 155
  • 9

1 Answers1

1

Please verify have you done like this or not. click on jar file and --> go to Source attachments--> click on Edit button and select the source path of the jar file.

enter image description here

Bhaskara Arani
  • 1,556
  • 1
  • 26
  • 44
  • Yes, the sources are attached, but are not seen, for both the aforementioned libraries. – Adrian Sep 30 '16 at 10:22
  • There may be a case, the jars or zip file your are using may not have the source files. Or in some cases the file which ur using to attach has different folder structure – Bhaskara Arani Sep 30 '16 at 10:35
  • These libs are validated by the Maven central, as for both their content and meta, so that's an IDE issue – cchantep Sep 30 '16 at 10:58
  • Yes, I just discovered the culprit. As Arani said the folder structure differs. The jars have a folder structure Java-like with folders mimicking the package naming, while the sources jars have a flattened folder structure. I unpacked the sources jars , changed the folder structure accordingly and except some small issues still persisting things are OK know. – Adrian Sep 30 '16 at 12:14
  • That's great @Adiran, we solved the issue, please accept this as Answer for others to help in future – Bhaskara Arani Sep 30 '16 at 12:15
  • @cchantep looks like a bug in the library creation to me, perhaps the Maven validation process is not that detailed. If help is needed fixing it let me know, I might find some time to help – Adrian Sep 30 '16 at 12:16
  • Its may not be a bug, they gave all in zip file which ever necessary to run, we need to seperate it use – Bhaskara Arani Sep 30 '16 at 12:17
  • being the library maintainer, I can confirm that Maven central validate such aspect, so unless you have specific element, that's an IDE issue – cchantep Sep 30 '16 at 14:04
  • I just saw on GitHub that the sources have a flattened directory structure as well, so the Maven plugin you are using to generate the sources jar maintains that flattened folder structure, while the plugin that generates the .class files must respect the JVM conventions and creates the directory structure mimicking the package declaration. One solution would be to make the plugin that generates the sources jar to generate the directory structure as well, the other of course, as you say, the more correct one to make Scala IDE smart enough to sort things out by itself. Thanks – Adrian Oct 01 '16 at 13:22