Skip to content
Advertisement

What is the command line equivalent for Intellij Download sources option?

When I view a decompiled class file from maven project in Intellij it has Download Sources button at the top.

What is the command line equivalent of this button? I know there is a command mvn dependency:sources but it downloads sources for everything which makes Intellij/my web app lag so much that it is not practical for everyday use. How can I get source just for that one class and make Intellij show it instead of decompiled code?

Advertisement

Answer

You can set the includeArtifactIds property of maven dependency plugin to donwload only one jar:

mvn dependency:sources -DincludeArtifactIds=commons-lang3

You cannot download a single class at a time. When you use “Download sources” in IntelliJ, it downloads the complete sources for that jar.

There are more options for dependency:sources, see https://maven.apache.org/plugins/maven-dependency-plugin/sources-mojo.html.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement