Issue
I'm currently working on a large shared project consisting of many smaller sub-projects. Recently the team migrated the build system to maven, however we currently have no source/javadoc information showing up in the eclipse editor for any of our referenced libraries.
I've been looking into a solution and gotten pretty far, with the maven dependency plugin I was able to copy source jars from my maven local repository into a shared folder one level above the sub-projects. I then used a linked folder in the sub-projects to reference the shared source jars folder. Finally I referenced the local linked folder from the .classpath files of each sub-project. This could all be done in a relative manner by making use of various variables.
I'm wondering now, if there's an even better way to do it. If I can create a linked folder in each project that goes straight to the maven local repository then I can eliminate the need to create an extra copy of all the source jars.
So far I have been unable to figure out a way to do this without specifying an absolute path, or making assumptions about the location of the maven local repository relative to the workspace directory (or something similar).
Solution
You don't need to do any of this.
If you use a jar as a <dependency>
in Maven, then Eclipse automatically finds the x-sources.jar
that lies next to the dependency.
So if you build a project with attached sources
jar and then use it in another Maven project, the sources
jar is found without further configuration.
Answered By - J Fabian Meier