Download Maven dependency sources and Javadocs for IntelliJ Idea
Published: 2024-11-24 00:33
After searching for a while, I found it:
Outright running:
1
mvn dependency:sources
As suggested in many sites did not work for my project, but instead running it with a ~clean install~ appended did the trick:
1
mvn clean install dependency:sources -Dmaven.test.skip=true
After that command, run the following for installing all javadocs:
1
mvn dependency:resolve -Dclassifier=javadoc
Of course, both can be run at the same time:
1
mvn clean install dependency:sources dependency:resolve -Dmaven.test.skip=true -Dclassifier=javadoc
Note that the above command should be run whenever the ~pom.xml~ changes, so it can download the new sources and Javadocs.
Previous attempts
From the same StackOverflow question, adding the following to my ~~/.m2/settings.xml~ did not work, but it apparently does work for users of Eclipse.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<settings>
<!-- ... other settings here ... -->
<profiles>
<profile>
<id>downloadSources</id>
<properties>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
</properties>
</profile>
</profiles>
<activeProfiles>
<activeProfile>downloadSources</activeProfile>
</activeProfiles>
</settings>