Maven download source code and javadoc command

Source: Internet
Author: User

Maven download source code and javadoc command

Abstract: When writing code, we often want to check the source code to see some details of the source code. Generally, in IDE (such as eclipse), you only need to press ctrl + and click the corresponding method to enter the corresponding source code section. However, in some cases, many dependencies do not download the corresponding source code by default. Therefore, you need to execute the following command for automatic download. Generally, you need to complete the following three steps:

1: Download the source code and javadocs using Maven commands.
When using Maven in IDE, if you want to view the source code and javadoc of the classes in the referenced jar package, you need to download these source codes using maven commands before introducing them, the mvn command can easily achieve this goal:

Mvn dependency: sources
Mvn dependency: resolve-Dclassifier = javadoc
Command usage: first enter the corresponding pom. xml directory, and then execute the preceding command:

The first command is to download the source code of the file that is dependent on pom. xml.

The second command is to download the corresponding javadocs

2: Add a configuration file
Open the maven configuration file setting. xml (MAVEN_HOME/conf/settings. xml) and add the following Configuration:

<Profiles>
<Profile>
<Id> downloadSources </id>
<Properties>
<DownloadSources> true </downloadSources>
<DownloadJavadocs> true </downloadJavadocs>
</Properties>
</Profile>
</Profiles>
 
<ActiveProfiles>
<ActiveProfile> downloadSources </activeProfile>
</ActiveProfiles>

3: Configure eclipse
Window> Preferences> Maven and checking the "Download Artifact Sources" and "Download Artifact JavaDoc" options. As follows:


 
 
After configuring these three steps, you can download the corresponding source file.

Maven build process details

Build a Maven repository on GitHub

Use Maven to build a Wicket project under NetBeans

Maven practice: Maven practice tutorial PDF

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.