Get source JARs and Javadoc from Maven repository

Sometimes you may want to use Javadoc feature of your eclipse IDE so that you may be able to refer the source code and javadoc while using some API.

javadoc

Option 1

Following maven commands come in handy for these purposes:

mvn dependency:sources
mvn dependency:resolve -Dclassifier=javadoc

First command attempts to download *-source.jar files for the dependencies listed in your pom.xml and second command downloads all the *-javadoc.jar

There is no guarantee that you will be getting sources and javadocs for all the jars. It really depends on whether the publisher of API published them to maven repo or not!

Option 2

If you are not convinced to run above commands then you may configure this in your pom.xml as below

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-eclipse-plugin</artifactId>
                <configuration>
                    <downloadSources>true</downloadSources>
                    <downloadJavadocs>true</downloadJavadocs>
                </configuration>
            </plugin>
        </plugins>
    </build>

also refer below link in order to generate source and javadoc jars for your project build.
https://maven.apache.org/plugin-developers/cookbook/attach-source-javadoc-artifacts.html

Advertisements

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: