Attaching Sources and JavaDoc to Maven Project

One of the features of Maven Dependency Plugin is attachment of sources to a project. The attachment can be accomplished from the command line without any pom.xml modification:

The following command downloads and attaches the sources to all dependencies listed in pom.xml:

mvn dependency:sources

With the optional classifier parameter, you can download and attach a javadoc jar to the project.

mvn dependency:sources -Dclassifier=javadoc

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting

NEW online workshop: WebStandards Igniter (online)

Airport MUC workshops: Java EE 7: Bootstrap, Effective, Architectures, Web, React and Angular, Testing and Microservices

Podcast: and newsletter:

A book about rethinking Java EE Patterns


hmmm, this might be a stupid question, but why anyone would benefit from doing it manually ? I mean Ide does is by itself, and without IDE you don't get any benefit from attachment of javadoc.jar, am I wrong ?

Posted by psychollek on December 22, 2014 at 10:08 AM CET #

I don't know how to tell Idea to download the source/javadoc for a particular library, so that command is perfect when being used with -DincludeGroupIds=...

Posted by Thai on December 26, 2014 at 09:25 AM CET #

Post a Comment:
  • HTML Syntax: NOT allowed
Online Workshops
...the last 150 posts
...the last 10 comments