Put dependency sources into a directory


(Christoph Sturm) #1

how can I make gradle download javadoc and source jars of all my runtime dependencies, and put them into a directory.

right now i do this:

task copyDeps(type: Copy) {

into “$buildDir/deps/lib”

from configurations.testRuntime

} to copy all jars to a local directory. Now I wanted to do the same for javadocs and sources but it seems most of the code that i would need to call is in org.gradle.plugins.ide.internal.

basically I’m using IDEA, but the generated idea project always crashes my IDE, so I just want to create the project myself.


(Peter Niederwieser) #2

You’d essentially have to reimplement what the IDE plugins do - iterate over the resolved dependencies and try to resolve corresponding dependencies with ‘sources’ and ‘javadoc’ classifiers. It might be more worthwhile to investigate why the generated IDEA project crashes, or to try IDEA’s built-in Gradle support (preferably using a 12.1 EAP version).


(Peter Niederwieser) #3

On second thought, you could run the ‘idea’ task and use a hook like ‘idea.module.iml.whenMerged { module -> module.dependencies.findAll { it instanceof org.gradle.plugins.ide.idea.model.ModuleLibrary } … }’ to get at the sources and Javadoc. See the Gradle Build Language Reference and Groovydoc for details. But first I’d try to solve the problem in other ways (see my previous post).