New in 11: Downloading sources of third party JAR’s from web

When exploring a code, sometimes you end up in a decompiled code from a JAR for which there’s no source code attached. Previously you had to:

    1. go find the source JAR on the Web
    2. download it to your disk
    3. go to your project structure settings
    4. attach the JAR to the library of interest

A bit too much, isn’t it? Now (in the next EAP) IntelliJ IDEA 11 does it all for you:

This entry was posted in New Features and tagged , . Bookmark the permalink.

23 Responses to New in 11: Downloading sources of third party JAR’s from web

  1. M says:

    This is the best thing ever!

  2. Eugene Kirpichov says:

    Guys, you do not seize to amaze me every time I think that there’s nothing more to be done to improve the Java development experience. This is awesome.

  3. Hani Suleiman says:

    Pretty amazing that you can still find ‘wow, how obvious now that I see it’ kind of features still. Nice work.

  4. xBlackCat says:

    Is it configurable? What libraries will be supported from out-of-box? Could list automatically updated from the server?

  5. Victor says:

    Joining xBlackCat: How does the tool know where to download the sources from?

  6. Igor Kolomiets says:

    How do you know which sources to download (e.g. when multiple versions exist)? Do you calculate some kind of signature of the local jar and then compare it to the signature of the jar in repository to figure correct sources?

  7. Sergey Evdokimov says:

    Igor, we just get version and artifact ID from jar’s name.

  8. Yes. If class file is located say in some-component-3.2.jar then sources for version 3.2 will be downloaded. Also, there is another quick fix available in IntelliJ IDEA 11 – you can find, download and setup a library for “red code” like shown here

  9. Brice says:

    Hi, this is cool. However does this feature will manage sources not packaged in the maven way. For example the source jar of CGLIB 2.2.2, which is downloaded from central, you have to point to the correct folder in the jar to get the root of the sources :


    Anyway, thx for this feature :)

  10. asaf says:

    please also support specifying the source location (artifactory repository, for example) for us guys on disconnected network environments

  11. sergei_ivanov says:

    Now, if only there was a decent decompiler bundled, that alone would justify an upgrade to version 11 for me. I gave up using decompiler plugins, because they have never worked correctly. Now I am using jd-gui whenever I need to have a look at decompiled sources, but I really really wish it was part of IDEA.

  12. xavier hanin says:

    Excellent. Reminds me the function
    nality I developped with my team in a now defunct plugin (worldofjava). But we used the jar md5 to identify it (relying on the name is error prone IMHO).

  13. greg says:

    As vaguely suggested above, finding/downloading the jar using the local copy’s checksum would be pretty neat, as it could also work for non-mavenized artifacts.

  14. Brice says:

    Agreed, a good decompiler plugin would be awesome.

    For information JD-GUI is available here as well as the eclipse plugin.

  15. Sergey Evdokimov says:

    Brice, of course we support this case. Sources for cglib-2.2.2.jar will be added correctly.

  16. Brice says:

    @Sergey Cool, that’s awesome. I got the case again in my maven project on the source artifact of stripes.

  17. maki says:

    Nice feature, thanks. Instead of version and artifact ID from name (sometimes version is missing in the name or it is not maven-like), maybe SHA1 checksum could also be used to identify a jar (groupId/artifactId/version) and find sources…

  18. madhav says:

    I like this jarfinder plugin. The only problem I have is that its not fetching sources for me at work (behind a firewall/proxy).

    2012-01-24 15:27:02,827 [ 57407] WARN – #com.intellij.jarFinder.SonatypeAttachSourceProvider – Connection timed out: connect Connection timed out: connect
    at Method)
    at com.intellij.jarFinder.SonatypeAttachSourceProvider$1$1.readDocumentCancelable(
    at com.intellij.jarFinder.SonatypeAttachSourceProvider$1$
    at com.intellij.openapi.progress.impl.ProgressManagerImpl$
    at com.intellij.openapi.progress.impl.ProgressManagerImpl$
    at com.intellij.openapi.progress.impl.ProgressManagerImpl$
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(
    at com.intellij.openapi.application.impl.ApplicationImpl$8$
    at com.intellij.openapi.application.impl.ApplicationImpl$
    at java.util.concurrent.Executors$
    at java.util.concurrent.FutureTask$Sync.innerRun(
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(
    at java.util.concurrent.ThreadPoolExecutor$
    at com.intellij.openapi.application.impl.ApplicationImpl$1$

  19. George M says:

    Now all we need is to be able to configure which repos it looks in. Sonatype’s repo is pretty good, but they are versions behind on some dependencies. Predictably enough, the exact ones I’m interested in.

  20. Eliot S says:

    +1 on being able to configure the repo to Sonatype alternatives.

  21. mebigfatguy says:

    how do you know what the extension is to the name. most times it’s sources but not always. do you just try a bunch?

  22. Mark says:

    This would be a great feature (if it was actually reliable), but alas it is not (reliable). For most legacy apps (which is 98% of the work in the IT world) the jars are available but the sources are not or they are now supported by a different group, so you must go find them and download them to your machine anyway.

  23. Gunnar says:

    you can download the jar files from this site by pasting the maven xml

Leave a Reply to Sergey Evdokimov Cancel reply

Your email address will not be published. Required fields are marked *