Is there a way to get Maven to install javadocs for all dependencies to my local repo?
By running mvn dependency:sources
I can force maven 开发者_运维知识库to resolve all dependencies in my project, download the sources, and install them into my local repo.
Is there something that does the same thing with my dependencies' JavaDocs? I.e. grab them from upstream repos and install them into my local repo.
There is a way to do it with the eclipse:eclipse
mojo using the downloadJavadocs
parameter.
mvn eclipse:eclipse -DdownloadJavadocs
And if you don't use eclipse, just do
mvn eclipse:clean
afterwards.
It's a hack, I know, but it works.
Actually, dependency:sources
pretends to be configurable through the classifier
and type
parameters, so for a moment I thought you could do this:
mvn dependency:sources -Dclassifier=javadoc -Dtype=jar
but I tried it and it didn't work. Then I checked the source code and found this:
private static final String SOURCE_TYPE = "java-source";
private static final String SOURCE_CLASSIFIER = "sources";
// ...
public void execute()
throws MojoExecutionException
{
// parameters are overwritten with constant values
this.classifier = SOURCE_CLASSIFIER;
this.type = SOURCE_TYPE;
I have now submitted a Bug concerning this.
精彩评论