Java Source Attacher

Add this URL to your Eclipse Installation to reach this Solution's Update Site.

Mars (4.5)
Luna (4.4)
Kepler (4.3)
Juno (4.2, 3.8)
Previous to Juno (<=4.1)

Learn more...

Details Group Tabs

Peter Wippermann's picture

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'

It would be great if the JavaScript could be adapted!

Thai Ha's picture

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

Peter Wippermann's picture

I have to add, that I tried to download sources for my commons-logging-1.2.jar.
The website in question was:

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?!

Thai Ha's picture

Thank you for finding this issue. It is also fixed.

Gonçalo Cardoso's picture

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.

Malte Mahlzahn's picture

I tried attaching the sources of SWT and the JDT but neither of them works.
I am using Luna on Linux.

Thai Ha's picture

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.

David Clemens's picture

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.

Johan Kempe's picture

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.

Thai Ha's picture

I tested with Eclipse 3.8 and your specified jar file at and it worked correctly for me.'s picture

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.

Thai Ha's picture

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.

Palmer Eldritch's picture

You say in the description :

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.

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

Thai Ha's picture

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.

Stephen Ranger's picture

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.

Thai Ha's picture

Tested today with Eclipse SDK Kepler (version 4.3). It works correctly.

Jordan Bentley's picture

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.

Thai Ha's picture

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

Sarang Anajwala's picture

where does this copy the source jar that it downloads?

Thai Ha's picture

Source code location for the plugin is /.sourceattacher/

ejaenv Mising name's picture

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"

Thai Ha's picture

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.