"If a worker wants to do his job well, he must first sharpen his tools." - Confucius, "The Analects of Confucius. Lu Linggong"
Front page > Programming > How Can I Download Source JARs and Javadocs From Maven Repositories?

How Can I Download Source JARs and Javadocs From Maven Repositories?

Posted on 2025-02-06
Browse:854

How Can I Download Source JARs and Javadocs From Maven Repositories?

Maven Source JAR Retrieval

It's possible to retrieve source JARs from Maven repositories using the following steps:

Step 1: Download Source Code

Execute the following command to download source code for all project dependencies:

mvn dependency:sources

Step 2: Download Javadocs

To download Javadocs, use the following command:

mvn dependency:resolve -Dclassifier=javadoc

Notes:

  • Maven's ability to retrieve source JARs and Javadocs depends on the availability of these artifacts in the repositories.
  • You can specify specific dependencies to retrieve using the -DincludeArtifactIds option. For example, to retrieve sources only for the guava dependency:
mvn dependency:sources -DincludeArtifactIds=guava

References:

  • [Maven Micro-Tip: Get sources and Javadocs](http://tedwise.com/2010/01/27/maven-micro-tip-get-sources-and-javadocs/)
  • [Maven Dependency Plugin - Sources Mojo](https://maven.apache.org/plugins/maven-dependency-plugin/sources-mojo.html)
Latest tutorial More>

Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.

Copyright© 2022 湘ICP备2022001581号-3