Add this URL to your Eclipse Installation to reach this Solution's Update Site.
Open source libraries are very popular in Java world. Nowadays Java/J2EE/Android developers often work with Java-based projects which using a lot of open source Java libraries.
One issue with using open source Java libraries is how to find documentation/source code for these open source libraries fast and easily? It is tedious and time consuming to search for the source code, download and attach source code packages to the libraries. If your project has 40 libraries, how long will it take to find source code for all libraries?
The solution is to use this Eclipse plugin to do the task for you with only one mouse click. This Eclipse plugin will help to find source code for open source Java libraries automatically from Internet. Just right click on a Java library, choose the menu item "Attach Java Source" and wait. The source code for the library will be found and attached to the Java library in several seconds.
- Use Update site URL: http://svn.codespot.com/a/eclipselabs.org/free-plugins/trunk/site/
- Or download offline: download plugin from http://svn.codespot.com/a/eclipselabs.org/free-plugins/trunk/site/plugin... and save it to eclipse/dropins/ folder
Note for Android developers:
- When programming Android projects using Google ADT plugin, the jar files inside libs folder will be added as libraries automatically but Eclipse will not allow change source code path for these libraries. This plugin can attach source code for Android libraries and will help Android developers in coding / debugging.
Right click on a Java library of a Java-based project and choose the menu item "Attach Java Source" and wait for the source code to be downloaded/attached to the library automatically (you will see a background job is running on Eclipse status bar).
- Find source code for Java libraries using all popular Java repositories on Internet (Like Maven Central repository, Nexus-based repositories, Eclipse P2 repositories, ...)
- Eclipse plugin developers can use this plugin to find source code for Eclipse plugins using Eclipse P2 repository.
- (NEW) Support attaching source code for rt.jar (i.e. Oracle JRE 7 or JRE 8). Please provide feedback for this feature.
- The plugin also uses a special cloud-based search service designed for the plugin. This search service contains information about all Apache Java projects. This means source code for any Apache Java-based library will be found.
- If source code for a Java library cannot be found, the user can help the community by providing the URL to the source code archive file (in Zip or Jar file format) or SCM URL (see below note) and the source code will be found next time! You are helping youself and others when providing information about source code for a library!
Tested with Eclipse 3.5 to 3.8 (but should also work with 4.x).
- JDK 6+
- Eclipse 3.5+
- An Internet connection (to search and download source code)
SCM URL format (used when you provide source code location from SCM systems):
The SCM URL will follow the format supported at http://maven.apache.org/scm/scm-url-format.html with option fragment to indicate version as below. Various SCM types are supported (Git SVN CVS Mercurial ...).
You might also like the plugins:
- Java Examples Search to find example code from Eclipse.
- Java Dependency Viewer to view your class dependencies and package dependencies visually.
Unsuccessful Installs in the last 7 Days:2
By adding the following code below to your website you will be able to add an install button for Java Source Attacher.HTML Code:
Submitted by Peter Wippermann on February 25, 2015 - 13:47
Where can I report bugs? There is no such feature here, is it?
The Source Attacher plugin doesn't work for me, but keeps hanging. The progress bar stays active forever.
I debugged the problem to the "WebBasedArtifactorySourceCodeFinder....js" file: The assignment of values to the input forms doesn't work.
Since the assignment doesn't work, the script keeps looping forever in the "sleep while loop".
I adapted the script as the following:
ie.document.getElementsByName('groupIdField').item(0).value = groupId
ie.document.getElementsByName('artifactIdField').item(0).value = artifactId
ie.document.getElementsByName('versionField').item(0).value = version
ie.document.getElementsByName('classifierField').item(0).value = 'sources'
Submitted by Thai Ha on April 10, 2015 - 10:22
I have updated the JS code as you suggested and verified that it is working good now. Thank you for contribution. NOTE: I used the same plugin version so you will see the changes when you installing in a new Eclipse
Submitted by Peter Wippermann on February 26, 2015 - 11:00
I have to add, that I tried to download sources for my commons-logging-1.2.jar.
The website in question was: repo.spring.io/webapp/gavcsearch.html?0
Even when I fixed the script and executed it, I saw that the search yields to two results: sources.jar and test-sources.jar.
And I saw, that the latter one is chosen and returned by the script. This doesn't seem to be correct?!
Submitted by Thai Ha on April 10, 2015 - 10:31
Thank you for finding this issue. It is also fixed.
Submitted by Gonçalo Cardoso on February 19, 2015 - 07:44
Is there any way to change where the sources are saved?
By default it's saved on C:\Users\xxxxxx\.sourceattacher but I wanted to save them inside the project so that I could share them with the rest of my team.
Submitted by Malte Mahlzahn on December 3, 2014 - 11:06
I tried attaching the sources of SWT and the JDT but neither of them works.
I am using Luna on Linux.
Submitted by Thai Ha on April 10, 2015 - 23:11
Some of the sites I used for search Eclipse plugin source code were not working. I have fixed by using some new sites. I tested with latest Eclipse (Luna) and verified that it can find the source code for plugins correctly. But one issue is the attached source jar will be lost the next time Eclipse is started so you will have to re-attach source again. Sorry about this issue but I don't see it will be fixed soon.
Submitted by David Clemens on April 11, 2014 - 17:54
I just installed this plugin in a Kepler Eclipse and asked it to attach the source for one of the core Eclipse plugins so that I could see how it worked. Plugin sources no longer seem to be included in Eclipse releases, and I had been very frustrated trying to find them. But this Attacher found them automatically, downloaded and attached them in a few minutes.
Worked like a charm. I can't speak for other Open Source jars, but for Eclipse plugin sources, it was exactly what I needed.
Submitted by Johan Kempe on January 14, 2014 - 09:50
It didnt work for me when I tried to attach gson-2.2.4-sources.jar to gson-2.2.4.jar
No error message, nothing happened.
Submitted by Thai Ha on March 27, 2014 - 21:23
I tested with Eclipse 3.8 and your specified jar file at http://repo1.maven.org/maven2/com/google/code/gson/gson/2.2.4/ and it worked correctly for me.
Submitted by dabraham_1234 on October 16, 2013 - 05:00
Thank you for this lovely tool! However, the option to 'Attach Java source' is grayed out for libraries that are in a different folder like say src/webroot/web-inf/lib. Also this option is grayed out when I try accessing it from the Navigator view, it's available in the Project Explorer view though. It would be nice if it can be activated for arbitrary libraries and in Navigator.
Submitted by Thai Ha on March 27, 2014 - 21:22
You must have the jar in the Build path of project first, the plugin cannot attach source code for any jar files not in project's Build Path.
Submitted by Palmer Eldritch on September 21, 2013 - 08:20
You say in the description :
Now I installed your pluggin (kepler eclipse release) but I find no way of attaching the source - can I provide a file/folder URL to the my library project in the workspace ?
Please help, if this really solved the (very annoying issue) with ADT I will be sure to advertise !
Eclipse Java EE IDE for Web Developers.
Version: Kepler Release
Build id: 20130614-0229
Submitted by Thai Ha on March 27, 2014 - 21:54
In Package Explorer view, expand "Referenced Libraries" of your Java project, right click on your jar file(s), choose the menu "Attach java Source". That's it.
Submitted by Stephen Ranger on April 16, 2013 - 10:58
I tried installing it to the developer preview 4.3 M6 and it made all right-clicking stop working. I didn't receive any exception.
Submitted by Thai Ha on March 27, 2014 - 21:55
Tested today with Eclipse SDK Kepler (version 4.3). It works correctly.
Submitted by Jordan Bentley on November 26, 2012 - 02:13
Is there a way to correct the database when it attaches the wrong source jar? The plugin keeps trying to attach the jcommander source to the testng library.
Submitted by Thai Ha on February 4, 2013 - 21:30
Sorry but there is no way to remove wrong links, could you give me the name+version or the md5 of the jar file? I will search and remove it from database
Submitted by Sarang Anajwala on July 11, 2012 - 09:59
where does this copy the source jar that it downloads?
Submitted by Thai Ha on February 4, 2013 - 21:27
Source code location for the plugin is /.sourceattacher/
Submitted by ejaenv on August 29, 2011 - 05:37
i tried axis.jar and commons-beanutils.jar with eclipe 3.6
I select the "Attach source file" option, and after doing this, I click on a class file but eclipse says "source not found"
Submitted by Thai Ha on January 10, 2012 - 00:33
There are some libraries which are not easy to find the source code automatically because it is not in our database yet. For these cases, you can help by providing the URL of the source code bundle (in zip or jar format) and the database will save the URL. Next time, you or other users will find the source code automatically.
Back to the top