Download sources of dependencies with maven

Maven is an amazing piece of software, despite all the criticism it has endured it is fascinating to me. However there is one short line that has made life so much easier for me:

mvn -Declipse.downloadSources=true

This tells maven to download all associated sources of jar files in the pom.xml. Amazing, how much easier it is to set up a project with proper debugging sources etc. There is even a cool eclipse integration available over at codehaus.org.

2 Responses to “Download sources of dependencies with maven”


  1. 1 Eric

    There’s an easier way if you use m2eclipse:

    In the Eclipse preferences, look for Maven.
    There you can configure two things:
    - Download Artifact Sources
    - Download Artifact JavaDoc

    Now whenever you specify a new dependency with m2eclipse, it downloads everything right from the start.

    Just right-click on the Eclipse project, choose Maven… Add Dependency…
    Then choose your dependency (if you have configured a repository with an index). It will be downloaded together with the sources and JavaDoc, and everything will be attached automatically by m2eclipse (check the Project’s build path).

  2. 2 Toni

    Yeah, using an IDE tool makes certain things easier. Although I found both m2eclipse and Q4E somewhat buggy. Still a long way to go to maturity, that’s why it’s a good idea to familiarize yourself with the command line as well.

Leave a Reply






Bad Behavior has blocked 1528 access attempts in the last 7 days.

FireStats iconPowered by FireStats