2015-08-20 53 views
0

我需要通過命令行下載Maven工件的javadocs。如何通過mvn命令行下載mvn依賴項的javadocs?

我試過這兩個版本,都失敗了,如下所示。什麼是修復?

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 

這一個下載的依賴項,但沒有下載javadocs。

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

這一個是給這個錯誤:

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]

回答

0

這個添加到settings.xml.m2文件夾中。

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

<activeProfiles> 
    <activeProfile>downloadSources</activeProfile> 
</activeProfiles> 
+0

最初,在沒有.m2目錄下的settings.xml。 Windows上的.m2文件夾位於我的userprofile文件夾中。 – vim

+0

我已經將settings.xml添加到.m2文件夾中。我做了同樣的事情,但沒有成功。 – vim

0

使用此:

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

參考docs,如果使用artifact然後classifier被忽略。

0

如果您只是需要的Javadoc JAR,你甚至不需要使用Maven:

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