I am using Gradle 2.0. What should I write in build.gradle
so that the javadocs and sources are also downloaded along with the jars?
cmcginty
Add the javadoc
or sources
classifies as dependencies:
dependencies {
compile "commons-codec:commons-codec:1.10:sources"
compile "commons-codec:commons-codec:1.10:javadoc"
}
Paul Podgorsek
I guess your question is related to a dev workspace, here are links explaining how to add the required configuration in Gradle using the IDEs' plugins:
For Eclipse:
apply plugin: 'java'
apply plugin: 'eclipse'
eclipse {
classpath {
downloadJavadoc = true
downloadSources = true
}
}
For IntelliJ & Android Studio
apply plugin: 'java'
apply plugin: 'idea'
idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
To run these plugins:
gradle cleanEclipse eclipse
gradle cleanIdea idea
You can write an ArtifactResolutionQuery that copies all SourcesArtifact and JavadocArtifact for each of your dependencies
See here for an example and here for the gradle source code which does it for the Eclipse/Intellij plugins
来源:https://stackoverflow.com/questions/28404149/how-to-download-javadocs-and-sources-for-jar-using-gradle-2-0