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: