vim
vim

Reputation: 1

How to download javadocs for mvn dependencies through mvn command line?

I need to download javadocs for a Maven artifact through command line.

I have tried these two versions, both have failed as follows. What is the fix?

mvn dependency:get -DrepoUrl=http://maven-repository.com/ -Dartifact=com.fasterxml.jackson.core:jackson-databind:2.6.1 -Ddest=C:\JarFilesDownload\jackson-databind.jar -DdownloadSources=true -DdownloadJavadocs=true

This one downloaded the dependency but did not download the javadocs.

mvn dependency:sources -Dclassifier=javadoc -Dartifact=com.fasterxml.jackson.core:jackson-databind:2.6.1 -Ddest=C:\JarFilesDownload\jackson-databind.jar

This one is giving this error:

Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:sources (default-cli): Goal requires a project to execute but there is no POM in this directory (C:\Users\jaligama). Please verify you invoked Maven from the correct directory. -> [Help 1]

Upvotes: 0

Views: 1546

Answers (3)

hzpz
hzpz

Reputation: 7966

If you just need the Javadoc JAR, you don't even need to use Maven:

curl -O https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.6.1/jackson-databind-2.6.1-javadoc.jar

Upvotes: 0

codesalsa
codesalsa

Reputation: 972

Use this:

$ mvn dependency:get -DgroupId=com.fasterxml.jackson.core -DartifactId=jackson- databind -Dversion=2.6.1 -Dclassifier=javadoc

Refer to docs, if you use artifact then classifier is ignored.

Upvotes: 2

praveen_mora
praveen_mora

Reputation: 34

Add this into settings.xml in .m2 folder.

<profiles>
    <profile>
        <id>downloadSources</id>
        <properties>
            <downloadSources>true</downloadSources>
            <downloadJavadocs>true</downloadJavadocs>
        </properties>
    </profile>
</profiles>

<activeProfiles>
    <activeProfile>downloadSources</activeProfile>
</activeProfiles>

Upvotes: 0

Related Questions