1: Maven command to download source code and javadocs
When using Maven in the IDE, if you want to see the source code and javadoc of the classes in the referenced jar package, you need to download the source code through the maven command, and then import it. This purpose can be easily achieved through the mvn command:
Copy the code code as follows:
mvn dependency:sources
mvn dependency:resolve -Dclassifier=javadoc
How to use the command: First enter the corresponding pom.xml directory, and then execute the above command:
The first command is an attempt to download the source code of the dependent files in pom.xml.
The second command: is to try to download the corresponding javadocs
But it is possible that some files do not have source code or javadocs
Reference article : reference
2: Add through configuration file
Open the maven configuration file setting.xml file (.../.m2/settings.xml) and add the following configuration:
Copy the code code as follows:
<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