Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven – Always download sources and javadocs

Tags:

java

maven

People also ask

How do I stop javadoc and download sources?

Progress is stuck in ... "download sources and javadoc" You can disable this in the Maven configuration: Window > Preferences > Maven > Disable "Download Artifact Sources" and "Download Artifact JavaDoc".

What does downloading maven sources and documentation do?

It also uses the sources to allow you to navigate to the actual code that you're calling -- this is useful when writing code and you need to know how a library is implemented or when debugging and you want to trace inside a library.

What is maven download sources?

By default, Maven only downloads the actual JAR file of each dependency, not the sources and documentation files. To download just the sources, first, we should navigate to the directory containing the pom.xml and then execute the command: mvn dependency:sources. It may take a while to download the sources.

What is source and javadoc?

The javadoc tool generates output that originates from the following types of source files: Java language source files for classes ( . java ), package comment files, overview comment files, and miscellaneous unprocessed files.


Open your settings.xml file ~/.m2/settings.xml (create it if it doesn't exist). Add a section with the properties added. Then make sure the activeProfiles includes the new profile.

<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>

In my case the "settings.xml" solution didn't work so I use this command in order to download all the sources:

mvn dependency:sources

You also can use it with other maven commands, for example:

mvn clean install dependency:sources -Dmaven.test.skip=true

To download all documentation, use the following command:

mvn dependency:resolve -Dclassifier=javadoc

Just consolidating and prepared the single command to address source and docs download...

mvn dependency:sources dependency:resolve -Dclassifier=javadoc

Answer for people from Google

In Eclipse you can manually download javadoc and sources.

To do that, right click on the project and use

  • Maven -> Download JavaDoc
  • Maven -> Download Sources